Skip to contentSkip to conversation

build: use _DEFAULT_SOURCE for newer glibc

PATCH In review Mike Frysinger 2 participants 5 messages Aug 18, 2015 – Aug 20, 2015 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build: use _DEFAULT_SOURCE for newer glibc

Since _BSD_SOURCE is deprecated with newer glibc versions, we get build warnings when using only that define. Add the newer _DEFAULT_SOURCE to quiet things down.

For example, we currently see:
In file included from /usr/include/math.h:26:0,
from libxt_hashlimit.c:15:
/usr/include/features.h:148:3: warning:

 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
---
 extensions/libxt_hashlimit.c | 1 +
 extensions/libxt_limit.c     | 1 +
 2 files changed, 2 insertions(+)
extensions/libxt_hashlimit.c +1 -0
index c5b8d77..cbe06bb 100644
@@ -10,6 +10,7 @@
  * 
  * Error corections by [email protected] (22.01.2005)
  */
+#define _DEFAULT_SOURCE 1
 #define _BSD_SOURCE 1
 #define _ISOC99_SOURCE 1
 #include <math.h>
extensions/libxt_limit.c +1 -0
index f75ef2f..dd8885a 100644
@@ -3,6 +3,7 @@
  * Jérôme de Vivie   <[email protected]>
  * Hervé Eychenne    <[email protected]>
  */
+#define _DEFAULT_SOURCE 1
 #define _BSD_SOURCE 1
 #define _ISOC99_SOURCE 1
 #include <math.h>
Signature · 6 lines
2.4.4

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
Quoted 3 lines · Mike Frysinger

Since _BSD_SOURCE is deprecated with newer glibc versions, we get build warnings when using only that define. Add the newer _DEFAULT_SOURCE to quiet things down.

Why do we even need _BSD_SOURCE/_ISOC99_SOURCE/_DEFAULT_SOURCE? The thing apparently builds without it (glibc-2.19), too.

#2 lore raw
Quoted 7 lines · Jan Engelhardt
Quoted 3 lines · Mike Frysinger

Since _BSD_SOURCE is deprecated with newer glibc versions, we get build warnings when using only that define. Add the newer _DEFAULT_SOURCE to quiet things down.

Why do we even need _BSD_SOURCE/_ISOC99_SOURCE/_DEFAULT_SOURCE? The thing apparently builds without it (glibc-2.19), too.

i would check with the guy who committed this ;)

commit 9921f2b9a241750e4730fc7d486687c6a32779f4

Author: Jan Engelhardt <[email protected]>
Date:   Wed Oct 10 00:35:14 2012 +0000

build: resolve compile abort in libxt_limit on RHEL5

libxt_limit.c: In function 'print_rate':
libxt_limit.c:124: error: 'INFINITY' undeclared (first use in this function)

The default mode of glibc-2.15's <features.h> sets "-D_POSIX_C_SOURCE=200809L", and therefore "-D_ISOC99_SOURCE". However, on þe olde RHEL 5's glibc-2.5, it only has "-D_POSIX_C_SOURCE=200112L".

Explicitly draw in the definition of INFINITY by always defining _ISOC99_SOURCE. By doing this, we are moving off of the default set, so _BSD_SOURCE also needs to be explicitly set to get at IFNAMSIZ that is used in xt_hashlimit.h.

-mike

#3 lore raw
Quoted 9 lines · Mike Frysinger
Quoted 7 lines · Jan Engelhardt
Quoted 3 lines · Mike Frysinger

Since _BSD_SOURCE is deprecated with newer glibc versions, we get build warnings when using only that define. Add the newer _DEFAULT_SOURCE to quiet things down.

Why do we even need _BSD_SOURCE/_ISOC99_SOURCE/_DEFAULT_SOURCE? The thing apparently builds without it (glibc-2.19), too.

Quoted 7 lines

i would check with the guy who committed this ;)

build: resolve compile abort in libxt_limit on RHEL5

libxt_limit.c: In function 'print_rate':
libxt_limit.c:124: error: 'INFINITY' undeclared (first use in this function)

Well if that is the case, have you checked that using _DEFAULT_SOURCE over _ISOC99_SOURCE+_BSD_SOURCE still works on RHEL5?

#4 lore raw
Quoted 12 lines · Jan Engelhardt
Quoted 11 lines · Mike Frysinger
Quoted 7 lines · Jan Engelhardt
Quoted 3 lines · Mike Frysinger

Since _BSD_SOURCE is deprecated with newer glibc versions, we get build warnings when using only that define. Add the newer _DEFAULT_SOURCE to quiet things down.

Why do we even need _BSD_SOURCE/_ISOC99_SOURCE/_DEFAULT_SOURCE? The thing apparently builds without it (glibc-2.19), too.

i would check with the guy who committed this ;)

Quoted 8 lines
Quoted 5 lines

build: resolve compile abort in libxt_limit on RHEL5

libxt_limit.c: In function 'print_rate':
libxt_limit.c:124: error: 'INFINITY' undeclared (first use in this function)

Well if that is the case, have you checked that using _DEFAULT_SOURCE over _ISOC99_SOURCE+_BSD_SOURCE still works on RHEL5?

i know it won't because _DEFAULT_SOURCE is new to glibc-2.19 -mike