features.h - confusing branch logic in preprocessor directives
Commit Message
Hi all,
There seem to be some tech debt in `features.h` on glibc master branch
when falling back to _DEFAULT_SOURCE. See the patch below:
1. Comment redundantly mentions _GNU_SOURCE but it is not tested anywhere.
2. Testing for _DEFAULT_SOURCE and redefining it if its already
defined makes no sense.
index 972cbd2..aa1bad8 100644
@@ -209,13 +209,11 @@
# define _ATFILE_SOURCE 1
#endif
-/* If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined,
- define _DEFAULT_SOURCE. */
-#if (defined _DEFAULT_SOURCE \
- || (!defined __STRICT_ANSI__ \
+/* If nothing is defined, define _DEFAULT_SOURCE. */
+#if (!defined __STRICT_ANSI__ \
&& !defined _ISOC99_SOURCE \
&& !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE \
- && !defined _XOPEN_SOURCE))
+ && !defined _XOPEN_SOURCE)
# undef _DEFAULT_SOURCE
# define _DEFAULT_SOURCE 1
#endif