diff mbox

[1/6] Replace deprecated macro 'BSD_SOURCE' with 'DEFAULT_SOURCE'

Message ID 20180720025038.9365-2-honli@redhat.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Honggang LI July 20, 2018, 2:50 a.m. UTC
From: Honggang Li <honli@redhat.com>

grep -r -l  '\-D_BSD_SOURCE=1'  | xargs -I {} sed -e 's/-D_BSD_SOURCE=1/-D_DEFAULT_SOURCE=1/' -i {}

Signed-off-by: Honggang Li <honli@redhat.com>
---
 complib/Makefile.am        | 2 +-
 opensm/Makefile.am         | 2 +-
 osmeventplugin/Makefile.am | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comments

Hal Rosenstock July 23, 2018, 4:17 p.m. UTC | #1
On 7/19/2018 10:50 PM, Honggang LI wrote:
> From: Honggang Li <honli@redhat.com>
> 
> grep -r -l  '\-D_BSD_SOURCE=1'  | xargs -I {} sed -e 's/-D_BSD_SOURCE=1/-D_DEFAULT_SOURCE=1/' -i {}

My understanding is that DEFAULT_SOURCE is glibc 2.19 or later and that glibc 2.19 or later doesn't warn if both BSD_SOURCE and DEFAULT_SOURCE are both defined. So shouldn't this define both ?

grep -r -l  '\-D_BSD_SOURCE=1'  | xargs -I {} sed -e 's/-D_BSD_SOURCE=1/-D_BSD_SOURCE=1 -D_DEFAULT_SOURCE=1/' -i {}

-- Hal

> Signed-off-by: Honggang Li <honli@redhat.com>
> ---
>  complib/Makefile.am        | 2 +-
>  opensm/Makefile.am         | 2 +-
>  osmeventplugin/Makefile.am | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/complib/Makefile.am b/complib/Makefile.am
> index 70e5681b4c86..df44c0bdb776 100644
> --- a/complib/Makefile.am
> +++ b/complib/Makefile.am
> @@ -9,7 +9,7 @@ else
>  DBGFLAGS = -g
>  endif
>  
> -libosmcomp_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
> +libosmcomp_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE=1
>  
>  if HAVE_LD_VERSION_SCRIPT
>      libosmcomp_version_script = -Wl,--version-script=$(srcdir)/libosmcomp.map
> diff --git a/opensm/Makefile.am b/opensm/Makefile.am
> index 86975d3f2147..260d6d298647 100644
> --- a/opensm/Makefile.am
> +++ b/opensm/Makefile.am
> @@ -1,7 +1,7 @@
>  
>  AM_CPPFLAGS = $(OSMV_INCLUDES) $(METIS_INCLUDES)
>  
> -AM_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
> +AM_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE=1
>  
>  lib_LTLIBRARIES = libopensm.la
>  
> diff --git a/osmeventplugin/Makefile.am b/osmeventplugin/Makefile.am
> index 01eeb0b0932d..ab42023a5220 100644
> --- a/osmeventplugin/Makefile.am
> +++ b/osmeventplugin/Makefile.am
> @@ -10,7 +10,7 @@ else
>  DBGFLAGS = -g
>  endif
>  
> -libosmeventplugin_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
> +libosmeventplugin_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE=1
>  
>  if HAVE_LD_VERSION_SCRIPT
>      libosmeventplugin_version_script = -Wl,--version-script=$(srcdir)/libosmeventplugin.map
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Honggang LI July 24, 2018, 2:12 a.m. UTC | #2
On Mon, Jul 23, 2018 at 12:17:42PM -0400, Hal Rosenstock wrote:
> On 7/19/2018 10:50 PM, Honggang LI wrote:
> > From: Honggang Li <honli@redhat.com>
> > 
> > grep -r -l  '\-D_BSD_SOURCE=1'  | xargs -I {} sed -e 's/-D_BSD_SOURCE=1/-D_DEFAULT_SOURCE=1/' -i {}
> 
> My understanding is that DEFAULT_SOURCE is glibc 2.19 or later and that glibc 2.19 or later doesn't warn if both BSD_SOURCE and DEFAULT_SOURCE are both defined. So shouldn't this define both ?

Yes, you are right. Confirmed gcc-8 works when both defined.

thanks

> 
> grep -r -l  '\-D_BSD_SOURCE=1'  | xargs -I {} sed -e 's/-D_BSD_SOURCE=1/-D_BSD_SOURCE=1 -D_DEFAULT_SOURCE=1/' -i {}

> 
> -- Hal
> 
> > Signed-off-by: Honggang Li <honli@redhat.com>
> > ---
> >  complib/Makefile.am        | 2 +-
> >  opensm/Makefile.am         | 2 +-
> >  osmeventplugin/Makefile.am | 2 +-
> >  3 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/complib/Makefile.am b/complib/Makefile.am
> > index 70e5681b4c86..df44c0bdb776 100644
> > --- a/complib/Makefile.am
> > +++ b/complib/Makefile.am
> > @@ -9,7 +9,7 @@ else
> >  DBGFLAGS = -g
> >  endif
> >  
> > -libosmcomp_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
> > +libosmcomp_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE=1
> >  
> >  if HAVE_LD_VERSION_SCRIPT
> >      libosmcomp_version_script = -Wl,--version-script=$(srcdir)/libosmcomp.map
> > diff --git a/opensm/Makefile.am b/opensm/Makefile.am
> > index 86975d3f2147..260d6d298647 100644
> > --- a/opensm/Makefile.am
> > +++ b/opensm/Makefile.am
> > @@ -1,7 +1,7 @@
> >  
> >  AM_CPPFLAGS = $(OSMV_INCLUDES) $(METIS_INCLUDES)
> >  
> > -AM_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
> > +AM_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE=1
> >  
> >  lib_LTLIBRARIES = libopensm.la
> >  
> > diff --git a/osmeventplugin/Makefile.am b/osmeventplugin/Makefile.am
> > index 01eeb0b0932d..ab42023a5220 100644
> > --- a/osmeventplugin/Makefile.am
> > +++ b/osmeventplugin/Makefile.am
> > @@ -10,7 +10,7 @@ else
> >  DBGFLAGS = -g
> >  endif
> >  
> > -libosmeventplugin_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
> > +libosmeventplugin_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE=1
> >  
> >  if HAVE_LD_VERSION_SCRIPT
> >      libosmeventplugin_version_script = -Wl,--version-script=$(srcdir)/libosmeventplugin.map
> > 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jason Gunthorpe July 24, 2018, 2:49 p.m. UTC | #3
On Mon, Jul 23, 2018 at 12:17:42PM -0400, Hal Rosenstock wrote:
> On 7/19/2018 10:50 PM, Honggang LI wrote:
> > From: Honggang Li <honli@redhat.com>
> > 
> > grep -r -l  '\-D_BSD_SOURCE=1'  | xargs -I {} sed -e 's/-D_BSD_SOURCE=1/-D_DEFAULT_SOURCE=1/' -i {}
> 
> My understanding is that DEFAULT_SOURCE is glibc 2.19 or later and that glibc 2.19 or later doesn't warn if both BSD_SOURCE and DEFAULT_SOURCE are both defined. So shouldn't this define both ?
> 
> grep -r -l '\-D_BSD_SOURCE=1' | xargs -I {} sed -e
> 's/-D_BSD_SOURCE=1/-D_BSD_SOURCE=1 -D_DEFAULT_SOURCE=1/' -i {}

You should just use _GNU_SOURCE which turns on every extension.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hal Rosenstock July 24, 2018, 6:20 p.m. UTC | #4
On 7/24/2018 10:49 AM, Jason Gunthorpe wrote:
> On Mon, Jul 23, 2018 at 12:17:42PM -0400, Hal Rosenstock wrote:
>> On 7/19/2018 10:50 PM, Honggang LI wrote:
>>> From: Honggang Li <honli@redhat.com>
>>>
>>> grep -r -l  '\-D_BSD_SOURCE=1'  | xargs -I {} sed -e 's/-D_BSD_SOURCE=1/-D_DEFAULT_SOURCE=1/' -i {}
>>
>> My understanding is that DEFAULT_SOURCE is glibc 2.19 or later and that glibc 2.19 or later doesn't warn if both BSD_SOURCE and DEFAULT_SOURCE are both defined. So shouldn't this define both ?
>>
>> grep -r -l '\-D_BSD_SOURCE=1' | xargs -I {} sed -e
>> 's/-D_BSD_SOURCE=1/-D_BSD_SOURCE=1 -D_DEFAULT_SOURCE=1/' -i {}
> 
> You should just use _GNU_SOURCE which turns on every extension.

Revised version of Honggang's patch to follow shortly.

-- Hal

> Jason
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/complib/Makefile.am b/complib/Makefile.am
index 70e5681b4c86..df44c0bdb776 100644
--- a/complib/Makefile.am
+++ b/complib/Makefile.am
@@ -9,7 +9,7 @@  else
 DBGFLAGS = -g
 endif
 
-libosmcomp_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
+libosmcomp_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE=1
 
 if HAVE_LD_VERSION_SCRIPT
     libosmcomp_version_script = -Wl,--version-script=$(srcdir)/libosmcomp.map
diff --git a/opensm/Makefile.am b/opensm/Makefile.am
index 86975d3f2147..260d6d298647 100644
--- a/opensm/Makefile.am
+++ b/opensm/Makefile.am
@@ -1,7 +1,7 @@ 
 
 AM_CPPFLAGS = $(OSMV_INCLUDES) $(METIS_INCLUDES)
 
-AM_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
+AM_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE=1
 
 lib_LTLIBRARIES = libopensm.la
 
diff --git a/osmeventplugin/Makefile.am b/osmeventplugin/Makefile.am
index 01eeb0b0932d..ab42023a5220 100644
--- a/osmeventplugin/Makefile.am
+++ b/osmeventplugin/Makefile.am
@@ -10,7 +10,7 @@  else
 DBGFLAGS = -g
 endif
 
-libosmeventplugin_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
+libosmeventplugin_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE=1
 
 if HAVE_LD_VERSION_SCRIPT
     libosmeventplugin_version_script = -Wl,--version-script=$(srcdir)/libosmeventplugin.map