netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] build: use _DEFAULT_SOURCE for newer glibc
@ 2015-08-18 22:07 Mike Frysinger
  2015-08-19  7:09 ` Jan Engelhardt
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2015-08-18 22:07 UTC (permalink / raw)
  To: netfilter-devel

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"

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 extensions/libxt_hashlimit.c | 1 +
 extensions/libxt_limit.c     | 1 +
 2 files changed, 2 insertions(+)

diff --git a/extensions/libxt_hashlimit.c b/extensions/libxt_hashlimit.c
index c5b8d77..cbe06bb 100644
--- a/extensions/libxt_hashlimit.c
+++ b/extensions/libxt_hashlimit.c
@@ -10,6 +10,7 @@
  * 
  * Error corections by nmalykh@bilim.com (22.01.2005)
  */
+#define _DEFAULT_SOURCE 1
 #define _BSD_SOURCE 1
 #define _ISOC99_SOURCE 1
 #include <math.h>
diff --git a/extensions/libxt_limit.c b/extensions/libxt_limit.c
index f75ef2f..dd8885a 100644
--- a/extensions/libxt_limit.c
+++ b/extensions/libxt_limit.c
@@ -3,6 +3,7 @@
  * Jérôme de Vivie   <devivie@info.enserb.u-bordeaux.fr>
  * Hervé Eychenne    <rv@wallfire.org>
  */
+#define _DEFAULT_SOURCE 1
 #define _BSD_SOURCE 1
 #define _ISOC99_SOURCE 1
 #include <math.h>
-- 
2.4.4

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] build: use _DEFAULT_SOURCE for newer glibc
  2015-08-18 22:07 [PATCH] build: use _DEFAULT_SOURCE for newer glibc Mike Frysinger
@ 2015-08-19  7:09 ` Jan Engelhardt
  2015-08-19 13:08   ` Mike Frysinger
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Engelhardt @ 2015-08-19  7:09 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: netfilter-devel

On Wednesday 2015-08-19 00:07, Mike Frysinger wrote:

>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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] build: use _DEFAULT_SOURCE for newer glibc
  2015-08-19  7:09 ` Jan Engelhardt
@ 2015-08-19 13:08   ` Mike Frysinger
  2015-08-20  8:12     ` Jan Engelhardt
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2015-08-19 13:08 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 1402 bytes --]

On 19 Aug 2015 09:09, Jan Engelhardt wrote:
> On Wednesday 2015-08-19 00:07, Mike Frysinger wrote:
> >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 <jengelh@inai.de>
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.
    
    Signed-off-by: Jan Engelhardt <jengelh@inai.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] build: use _DEFAULT_SOURCE for newer glibc
  2015-08-19 13:08   ` Mike Frysinger
@ 2015-08-20  8:12     ` Jan Engelhardt
  2015-08-20 10:49       ` Mike Frysinger
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Engelhardt @ 2015-08-20  8:12 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: netfilter-devel


On Wednesday 2015-08-19 15:08, Mike Frysinger wrote:
>On 19 Aug 2015 09:09, Jan Engelhardt wrote:
>> On Wednesday 2015-08-19 00:07, Mike Frysinger wrote:
>> >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 ;)
>
>    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?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] build: use _DEFAULT_SOURCE for newer glibc
  2015-08-20  8:12     ` Jan Engelhardt
@ 2015-08-20 10:49       ` Mike Frysinger
  0 siblings, 0 replies; 5+ messages in thread
From: Mike Frysinger @ 2015-08-20 10:49 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 1022 bytes --]

On 20 Aug 2015 10:12, Jan Engelhardt wrote:
> On Wednesday 2015-08-19 15:08, Mike Frysinger wrote:
> >On 19 Aug 2015 09:09, Jan Engelhardt wrote:
> >> On Wednesday 2015-08-19 00:07, Mike Frysinger wrote:
> >> >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 ;)
> >
> >    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

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-08-20 10:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-18 22:07 [PATCH] build: use _DEFAULT_SOURCE for newer glibc Mike Frysinger
2015-08-19  7:09 ` Jan Engelhardt
2015-08-19 13:08   ` Mike Frysinger
2015-08-20  8:12     ` Jan Engelhardt
2015-08-20 10:49       ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).