diff mbox series

[opensm] Replace deprecated 'BSD_SOURCE' macro in Makefiles with GNU_SOURCE

Message ID 684221ea-4b2f-c9d8-efc9-a7a870e41949@dev.mellanox.co.il (mailing list archive)
State Not Applicable
Headers show
Series [opensm] Replace deprecated 'BSD_SOURCE' macro in Makefiles with GNU_SOURCE | expand

Commit Message

Hal Rosenstock July 24, 2018, 6:21 p.m. UTC
to eliminate the following warning with gcc8:
_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE

'BSD_SOURCE' macro is deprecated in glibc >= 2.19

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

Also, remove explicit defines of _GNU_SOURCE

Signed-off-by: Honggang Li <honli@redhat.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
---
 complib/Makefile.am        | 2 +-
 complib/cl_nodenamemap.c   | 1 -
 opensm/Makefile.am         | 2 +-
 opensm/osm_console.c       | 1 -
 opensm/osm_console_io.c    | 1 -
 opensm/osm_torus.c         | 3 ---
 osmeventplugin/Makefile.am | 2 +-
 7 files changed, 3 insertions(+), 9 deletions(-)

Comments

Honggang LI July 25, 2018, 12:51 a.m. UTC | #1
On Tue, Jul 24, 2018 at 02:21:07PM -0400, Hal Rosenstock wrote:
> 
> to eliminate the following warning with gcc8:
> _BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE
> 
> 'BSD_SOURCE' macro is deprecated in glibc >= 2.19
> 
> grep -r -l  '\-D_BSD_SOURCE=1'  | xargs -I {} sed -e 's/-D_BSD_SOURCE=1/-D_GNU_SOURCE=1/' -i {}
> 
> Also, remove explicit defines of _GNU_SOURCE
> 
> Signed-off-by: Honggang Li <honli@redhat.com>
> Signed-off-by: Hal Rosenstock <hal@mellanox.com>
> ---
>  complib/Makefile.am        | 2 +-
>  complib/cl_nodenamemap.c   | 1 -
>  opensm/Makefile.am         | 2 +-
>  opensm/osm_console.c       | 1 -
>  opensm/osm_console_io.c    | 1 -
>  opensm/osm_torus.c         | 3 ---
>  osmeventplugin/Makefile.am | 2 +-
>  7 files changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/complib/Makefile.am b/complib/Makefile.am
> index 70e5681..21e496a 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_GNU_SOURCE=1
>  
>  if HAVE_LD_VERSION_SCRIPT
>      libosmcomp_version_script = -Wl,--version-script=$(srcdir)/libosmcomp.map
> diff --git a/complib/cl_nodenamemap.c b/complib/cl_nodenamemap.c
> index 8ac88cd..353f58c 100644
> --- a/complib/cl_nodenamemap.c
> +++ b/complib/cl_nodenamemap.c
> @@ -32,7 +32,6 @@
>   *
>   */
>  
> -#define _GNU_SOURCE
>  #include <stdio.h>
>  #include <errno.h>
>  #include <string.h>
> diff --git a/opensm/Makefile.am b/opensm/Makefile.am
> index 86975d3..658cc86 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_GNU_SOURCE=1
>  
>  lib_LTLIBRARIES = libopensm.la
>  
> diff --git a/opensm/osm_console.c b/opensm/osm_console.c
> index 0b20b13..9b91a42 100644
> --- a/opensm/osm_console.c
> +++ b/opensm/osm_console.c
> @@ -37,7 +37,6 @@
>  #  include <config.h>
>  #endif				/* HAVE_CONFIG_H */
>  
> -#define _GNU_SOURCE		/* for getline */
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <sys/poll.h>
> diff --git a/opensm/osm_console_io.c b/opensm/osm_console_io.c
> index e358a55..f529e25 100644
> --- a/opensm/osm_console_io.c
> +++ b/opensm/osm_console_io.c
> @@ -46,7 +46,6 @@
>  #  include <config.h>
>  #endif				/* HAVE_CONFIG_H */
>  
> -#define _GNU_SOURCE		/* for getline */
>  #ifdef ENABLE_OSM_CONSOLE_LOOPBACK
>  #include <tcpd.h>
>  #include <arpa/inet.h>
> diff --git a/opensm/osm_torus.c b/opensm/osm_torus.c
> index 5e788b3..9165c99 100644
> --- a/opensm/osm_torus.c
> +++ b/opensm/osm_torus.c
> @@ -35,9 +35,6 @@
>   *
>   */
>  
> -/* for getline() in stdio.h */
> -#define _GNU_SOURCE
> -
>  #include <stdint.h>
>  #include <stdbool.h>
>  #include <stdlib.h>
> diff --git a/osmeventplugin/Makefile.am b/osmeventplugin/Makefile.am
> index 01eeb0b..d86b635 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_GNU_SOURCE=1
>  
>  if HAVE_LD_VERSION_SCRIPT
>      libosmeventplugin_version_script = -Wl,--version-script=$(srcdir)/libosmeventplugin.map

Acked-by: Honggang Li <honli@redhat.com>
thanks
--
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 series

Patch

diff --git a/complib/Makefile.am b/complib/Makefile.am
index 70e5681..21e496a 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_GNU_SOURCE=1
 
 if HAVE_LD_VERSION_SCRIPT
     libosmcomp_version_script = -Wl,--version-script=$(srcdir)/libosmcomp.map
diff --git a/complib/cl_nodenamemap.c b/complib/cl_nodenamemap.c
index 8ac88cd..353f58c 100644
--- a/complib/cl_nodenamemap.c
+++ b/complib/cl_nodenamemap.c
@@ -32,7 +32,6 @@ 
  *
  */
 
-#define _GNU_SOURCE
 #include <stdio.h>
 #include <errno.h>
 #include <string.h>
diff --git a/opensm/Makefile.am b/opensm/Makefile.am
index 86975d3..658cc86 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_GNU_SOURCE=1
 
 lib_LTLIBRARIES = libopensm.la
 
diff --git a/opensm/osm_console.c b/opensm/osm_console.c
index 0b20b13..9b91a42 100644
--- a/opensm/osm_console.c
+++ b/opensm/osm_console.c
@@ -37,7 +37,6 @@ 
 #  include <config.h>
 #endif				/* HAVE_CONFIG_H */
 
-#define _GNU_SOURCE		/* for getline */
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/poll.h>
diff --git a/opensm/osm_console_io.c b/opensm/osm_console_io.c
index e358a55..f529e25 100644
--- a/opensm/osm_console_io.c
+++ b/opensm/osm_console_io.c
@@ -46,7 +46,6 @@ 
 #  include <config.h>
 #endif				/* HAVE_CONFIG_H */
 
-#define _GNU_SOURCE		/* for getline */
 #ifdef ENABLE_OSM_CONSOLE_LOOPBACK
 #include <tcpd.h>
 #include <arpa/inet.h>
diff --git a/opensm/osm_torus.c b/opensm/osm_torus.c
index 5e788b3..9165c99 100644
--- a/opensm/osm_torus.c
+++ b/opensm/osm_torus.c
@@ -35,9 +35,6 @@ 
  *
  */
 
-/* for getline() in stdio.h */
-#define _GNU_SOURCE
-
 #include <stdint.h>
 #include <stdbool.h>
 #include <stdlib.h>
diff --git a/osmeventplugin/Makefile.am b/osmeventplugin/Makefile.am
index 01eeb0b..d86b635 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_GNU_SOURCE=1
 
 if HAVE_LD_VERSION_SCRIPT
     libosmeventplugin_version_script = -Wl,--version-script=$(srcdir)/libosmeventplugin.map