This is the mail archive of the libc-alpha@sourceware.org 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]

[PATCH] BZ #16632: Disable _SVID_SOURCE/_BSD_SOURCE warning if _DEFAULT_SOURCE is defined.


Joseph,

Source packages that need to support both 2.19 and 
2.20 will need to decide to use _BSD_SOURCE and
_SVID_SOURCE vs. _DEFAULT_SOURCE.

The difficulty in making that decision is that 
__GLIBC_MINOR__ is itself defined in features.h, 
but you want to set the feature test macros before 
including features.h.

Therefore to ease the transition we should disable 
the warning if _DEFAULT_SOURCE is also defined.

The alternatives require having configure in your 
package and checking for the warning and then setting 
an additional define to control which feature macro 
to use. This is cumbersome and complicates application 
configuration, and doesn't work if the application 
doesn't use configure.

The easiest solution is to disable the warning if 
_DEFAULT_SOURCE is defined, indicating that the user 
has transitioned the package, but is defining the 
other defines for legacy purposes. Eventually we 
will just ignore those defines.

This patch disables the warning if _DEFAULT_SOURCE
is defined.

Tested on x86-64 with no regressions.

Tested by building several test applications making
use of the three defines and working through the
transition from 2.19 to 2.20.

Additionally tested in Fedora Rawhide where reports
arrived about packages having problems building.

Updated 2.20 notes for this transition:
https://sourceware.org/glibc/wiki/Release/2.20#Packaging_Changes

OK to checkin?

2014-02-25  Carlos O'Donell  <carlos@redhat.com>

	* include/features.h: Don't warn about _BSD_SOURCE
	or _SVID_SOURCE if _DEFAULT_SOURCE is defined.

diff --git a/include/features.h b/include/features.h
index 75237a7..c3ed81f 100644
--- a/include/features.h
+++ b/include/features.h
@@ -140,8 +140,11 @@
 #endif
 
 /* _BSD_SOURCE and _SVID_SOURCE are deprecated aliases for
-   _DEFAULT_SOURCE.  */
-#if defined _BSD_SOURCE || defined _SVID_SOURCE
+   _DEFAULT_SOURCE.  If _DEFAULT_SOURCE is present we do not
+   issue a warning; the expectation is that the source is being
+   transitioned to use the new macro.  */
+#if (defined _BSD_SOURCE || defined _SVID_SOURCE) \
+    && !defined _DEFAULT_SOURCE
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
 # undef  _DEFAULT_SOURCE
 # define _DEFAULT_SOURCE       1
--

Cheers,
Carlos.


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