Add a features.h to auto enable _DEFAULT_SOURCE

Unless __STRICT_ANSI__ is defined (as it is when running the compiler in
--std=c89 or --std=c99, but not when running it without any specific
args), we can enable these by default and behave like most other
systems. I don't know why no one has done this yet despite suggesting it
multiple times and people prefer to #define _BSD_SOURCE manually
everywhere.

Remove all places in our Jamfiles and sources where it had been defined.
_DEFAULT_SOURCE is now enabled by default for all sources of Haiku, since we
let the compiler use GNU extensions (no strict C standard specified on
command line)

Use _DEFAULT_SOURCE as the define name to match current versions of
glibc. Enable it if _BSD_SOURCE is #defined in compiler flags, for
backward compatibility.

Change-Id: I6db04da5f6db437723cdfba3478f5094a69d7727
Reviewed-on: https://review.haiku-os.org/c/1633
Reviewed-by: Jérôme Duval <[email protected]>
This commit is contained in:
Adrien Destugues
2019-07-29 20:26:46 +00:00
committed by Adrien Destugues
parent 70e55f0046
commit 4950607607
52 changed files with 92 additions and 63 deletions
-1
View File
@@ -2,7 +2,6 @@ SubDir HAIKU_TOP src bin fwcontrol ;
UseHeaders [ FDirName $(HAIKU_TOP) headers compatibility bsd ] : true ;
UsePrivateHeaders firewire ;
SubDirCcFlags [ FDefines _BSD_SOURCE=1 ] ;
BinCommand fwcontrol :
eui64.c
-1
View File
@@ -7,7 +7,6 @@ UsePrivateHeaders kernel ;
UsePrivateHeaders libroot ;
UsePrivateHeaders shared ;
UseHeaders [ FDirName $(HAIKU_TOP) headers compatibility bsd ] : true ;
SubDirC++Flags [ FDefines _BSD_SOURCE=1 ] ;
StaticLibrary libmultiuser_utils.a : multiuser_utils.cpp ;
-1
View File
@@ -2,7 +2,6 @@ SubDir HAIKU_TOP src bin network ftpd ;
UseHeaders [ FDirName $(HAIKU_TOP) headers compatibility bsd ] : true ;
UseHeaders $(SUBDIR) : true ;
SubDirCcFlags [ FDefines _BSD_SOURCE=1 ] ;
BinCommand ftpd :
ftpd.c
-2
View File
@@ -5,8 +5,6 @@ UsePrivateHeaders net ;
UseHeaders [ FDirName $(HAIKU_TOP) src libs compat ] : true ;
UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_wlan ] : true ;
SubDirC++Flags [ FDefines _BSD_SOURCE=1 ] ;
BinCommand ifconfig :
ifconfig.cpp
MediaTypes.cpp
+1 -1
View File
@@ -6,7 +6,7 @@ UseHeaders [ FDirName $(HAIKU_TOP) src libs libtelnet ] : false ;
UseBuildFeatureHeaders ncurses ;
local defines = [ FDefines USE_TERMIO=1 OLD_ENVIRON=1 ENV_HACK=1 _BSD_SOURCE=1 ] ;
local defines = [ FDefines USE_TERMIO=1 OLD_ENVIRON=1 ENV_HACK=1 ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags $(defines) ;
+1 -1
View File
@@ -5,7 +5,7 @@ UseHeaders [ FDirName $(HAIKU_TOP) headers compatibility bsd ] : true ;
UseHeaders [ FDirName $(HAIKU_TOP) src libs ] : true ;
UseHeaders [ FDirName $(HAIKU_TOP) src libs libtelnet ] : false ;
local defines = [ FDefines USE_TERMIO=1 _BSD_SOURCE=1 ] ;
local defines = [ FDefines USE_TERMIO=1 ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags $(defines) ;