Skip to content

Commit 2631cb6

Browse files
committed
always define _GNU_SOURCE and _DEFAULT_SOURCE
1 parent 6341168 commit 2631cb6

File tree

12 files changed

+34
-71
lines changed

12 files changed

+34
-71
lines changed

bin/xbps-fbulk/main.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@
4747
* Only one attempt is made to build any given package, no matter how many
4848
* other packages depend on it.
4949
*/
50-
#define _DEFAULT_SOURCE
51-
#define _BSD_SOURCE
5250

5351
#include <sys/file.h>
5452
#include <sys/stat.h>

bin/xbps-query/search.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@
2323
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2424
*/
2525

26-
#ifdef HAVE_STRCASESTR
27-
# define _GNU_SOURCE /* for strcasestr(3) */
28-
#endif
29-
30-
#include "compat.h"
31-
3226
#include <assert.h>
3327
#include <errno.h>
3428
#include <fnmatch.h>

bin/xbps-uchroot/main.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,28 @@
3232
* - Supports overlayfs on a temporary directory or a tmpfs mount.
3333
* - Supports read-only bind mounts.
3434
*/
35-
#define _GNU_SOURCE
36-
#define _XOPEN_SOURCE 700
37-
#include <sys/types.h>
38-
#include <sys/prctl.h>
35+
3936
#include <sys/fsuid.h>
4037
#include <sys/mount.h>
38+
#include <sys/prctl.h>
4139
#include <sys/syscall.h>
40+
#include <sys/types.h>
4241
#include <sys/wait.h>
43-
#include <unistd.h>
44-
#include <stdio.h>
45-
#include <fcntl.h>
46-
#include <errno.h>
47-
#include <stdarg.h>
48-
#include <string.h>
42+
4943
#include <assert.h>
50-
#include <stdlib.h>
51-
#include <sched.h>
52-
#include <limits.h> /* PATH_MAX */
44+
#include <dirent.h>
45+
#include <errno.h>
46+
#include <fcntl.h>
5347
#include <ftw.h>
54-
#include <signal.h>
5548
#include <getopt.h>
56-
#include <dirent.h>
49+
#include <limits.h>
50+
#include <sched.h>
51+
#include <signal.h>
52+
#include <stdarg.h>
53+
#include <stdio.h>
54+
#include <stdlib.h>
55+
#include <string.h>
56+
#include <unistd.h>
5757

5858
#include <xbps.h>
5959
#include "queue.h"

bin/xbps-uunshare/main.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,26 @@
2222
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2323
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2424
*/
25-
#define _GNU_SOURCE
26-
#include <sys/types.h>
27-
#include <sys/mount.h>
25+
2826
#include <sys/fsuid.h>
27+
#include <sys/mount.h>
28+
#include <sys/types.h>
2929
#include <sys/wait.h>
30+
31+
#include <assert.h>
32+
#include <errno.h>
33+
#include <fcntl.h>
34+
#include <getopt.h>
35+
#include <grp.h>
36+
#include <limits.h>
3037
#include <sched.h>
38+
#include <signal.h>
39+
#include <stdarg.h>
3140
#include <stdio.h>
3241
#include <stdlib.h>
3342
#include <string.h>
34-
#include <unistd.h>
35-
#include <stdarg.h>
36-
#include <signal.h>
37-
#include <fcntl.h>
38-
#include <grp.h>
39-
#include <errno.h>
40-
#include <limits.h>
4143
#include <syscall.h>
42-
#include <assert.h>
43-
#include <getopt.h>
44+
#include <unistd.h>
4445

4546
#include <xbps.h>
4647
#include "queue.h"

configure

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,10 @@ if [ -n "$FULL_DEBUG" ]; then
219219
echo "CPPFLAGS+= -DFULL_DEBUG" >>$CONFIG_MK
220220
fi
221221

222+
echo "CPPFLAGS += -D_DEFAULT_SOURCE" >>$CONFIG_MK
223+
echo "CPPFLAGS += -D_GNU_SOURCE" >>$CONFIG_MK
222224
case "$OS" in
223225
linux)
224-
echo "CPPFLAGS += -D_XOPEN_SOURCE=700" >>$CONFIG_MK
225226
echo "CPPFLAGS += -D_FILE_OFFSET_BITS=64" >> $CONFIG_MK
226227
;;
227228
*)

lib/cb_util.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2424
*/
2525

26-
#ifdef HAVE_VASPRINTF
27-
# define _GNU_SOURCE /* for vasprintf(3) */
28-
#endif
29-
3026
#include <stdio.h>
3127
#include <stdbool.h>
3228
#include <stdlib.h>

lib/external/dewey.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@
3131
#include <assert.h>
3232
#include <stdio.h>
3333
#include <stdlib.h>
34-
#define _BSD_SOURCE
3534
#include <string.h>
36-
#undef _BSD_SOURCE
3735
#include <strings.h>
3836
#include <ctype.h>
3937

lib/external/fexec.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,15 @@
2727
* POSSIBILITY OF SUCH DAMAGE.
2828
*/
2929

30-
#define _BSD_SOURCE /* for vfork and chroot */
31-
#define _DEFAULT_SOURCE /* glibc>=2.20 */
3230
#include <sys/types.h>
33-
#include <unistd.h>
34-
3531
#include <sys/wait.h>
32+
3633
#include <errno.h>
3734
#include <stdarg.h>
3835
#include <stdlib.h>
3936
#include <string.h>
37+
#include <unistd.h>
4038

41-
#undef _DEFAULT_SOURCE
42-
#undef _BSD_SOURCE
4339
#include "xbps_api_impl.h"
4440

4541
static int

lib/fetch/ftp.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@
5757
*
5858
*/
5959

60-
#ifdef __linux__
61-
/* Keep this down to Linux, it can create surprises else where. */
62-
#define _GNU_SOURCE
63-
#endif
64-
6560
#include <sys/types.h>
6661
#include <sys/socket.h>
6762

lib/fetch/http.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@
6262
* SUCH DAMAGE.
6363
*/
6464

65-
#if defined(__linux__)
66-
#define _GNU_SOURCE
67-
#endif
68-
6965
#include <sys/types.h>
7066
#include <sys/socket.h>
7167

lib/portableproplib/prop_object.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@
3636
static pthread_mutex_t _prop_refcnt_mtx = PTHREAD_MUTEX_INITIALIZER;
3737
#endif /* _PROP_NEED_REFCNT_MTX */
3838

39-
#define __USE_MISC /* MAP_ANON on glibc */
40-
# include <sys/mman.h>
41-
#undef __USE_MISC
39+
#include <sys/mman.h>
4240
#include <sys/stat.h>
4341
#include <errno.h>
4442
#include <fcntl.h>

lib/util.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,6 @@
2222
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2323
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2424
*/
25-
26-
#ifdef HAVE_VASPRINTF
27-
# define _GNU_SOURCE /* for vasprintf(3) */
28-
#endif
29-
30-
#if defined(HAVE_STRLCAT) || defined(HAVE_STRLCPY)
31-
# define _BSD_SOURCE
32-
#endif
33-
34-
#include "compat.h"
35-
3625
#include <sys/utsname.h>
3726

3827
#include <assert.h>
@@ -47,6 +36,7 @@
4736
#include <stdlib.h>
4837
#include <string.h>
4938

39+
#include "compat.h"
5040
#include "xbps_api_impl.h"
5141

5242
#ifdef __clang__

0 commit comments

Comments
 (0)