This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

features.h - confusing branch logic in preprocessor directives

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
--- include/features.h
+++ include/features.h
@@ -209,13 +209,11 @@
 # define _ATFILE_SOURCE  1

-/* 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)
 # define _DEFAULT_SOURCE 1

Kind regards,
Alex Yursha

Attachment: glibc_features.patch
Description: Binary data

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]