I want to use CPU_SET, which is a glibc linux-specific macro that should be defined in sched.h The manpage clearly states that _GNU_SOURCE
_GNU_SOURCE is the only one you should ever define yourself. __USE_GNU is defined internally through a mechanism in features.h (which is included by all other glibc headers) when _GNU_SOURCE is defined, and possibly under other conditions. Defining or undefining __USE_GNU yourself will badly break the glibc headers.
you have to define_GNU_SOURCE before anything else. This snippet works here:
#define _GNU_SOURCE
#include <sched.h>
int main()
{
cpu_set_t set;
CPU_SET(0, &set);
return 0;
}