headers: Change most remaining include guards to _DEFAULT_SOURCE.

We automatically enable _DEFAULT_SOURCE if _GNU_SOURCE is defined.
Rather than having even more optional methods undefined unless
_GNU_SOURCE manually is, just change all remaining guarts to
use _DEFAULT_SOURCE instead.

Fixes #19095.

Change-Id: I5c7baf40b7fb37913e24279589fc1ae706448a45
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8330
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This commit is contained in:
Augustin Cavalier 2024-09-16 13:33:23 -04:00 committed by waddlesplash
parent 5c1f231967
commit 90dca2bc8e
16 changed files with 28 additions and 21 deletions

View File

@ -7,9 +7,10 @@
#include_next <math.h>
#include <features.h>
#ifdef _GNU_SOURCE
#ifdef _DEFAULT_SOURCE
#ifdef __cplusplus

View File

@ -9,7 +9,8 @@
#include_next <pthread.h>
#include <features.h>
#ifdef _GNU_SOURCE
#ifdef _DEFAULT_SOURCE
#include <sched.h>

View File

@ -13,7 +13,7 @@
#include <sys/types.h>
#ifdef _GNU_SOURCE
#ifdef _DEFAULT_SOURCE
#ifndef CPU_SETSIZE

View File

@ -7,9 +7,10 @@
#include_next <spawn.h>
#include <features.h>
#ifdef _GNU_SOURCE
#ifdef _DEFAULT_SOURCE
#ifdef __cplusplus

View File

@ -11,9 +11,10 @@
#include_next <stdlib.h>
#include <features.h>
#ifdef _GNU_SOURCE
#ifdef _DEFAULT_SOURCE
#ifdef __cplusplus
@ -30,7 +31,7 @@ extern void qsort_r(void* base, size_t numElements, size_t sizeOfElement,
#endif
#endif /* _GNU_SOURCE */
#endif /* _DEFAULT_SOURCE */
#endif /* _GNU_STDLIB_H_ */

View File

@ -7,9 +7,10 @@
#include_next <string.h>
#include <features.h>
#ifdef _GNU_SOURCE
#ifdef _DEFAULT_SOURCE
#ifdef __cplusplus

View File

@ -13,6 +13,7 @@
extern "C" {
#endif
extern void *malloc(size_t numBytes);
extern void *realloc(void *oldPointer, size_t newSize);
extern void *calloc(size_t numElements, size_t size);
@ -20,10 +21,11 @@ extern void free(void *pointer);
extern void *memalign(size_t alignment, size_t numBytes) _ALIGNED_BY_ARG(1);
extern void *valloc(size_t numBytes);
#ifdef _GNU_SOURCE
#ifdef _DEFAULT_SOURCE
size_t malloc_usable_size(void *ptr);
#endif
#ifdef __cplusplus
}
#endif

View File

@ -49,7 +49,7 @@ extern void *tsearch(const void *key, void **_root,
extern void twalk(const void *root,
void (*action)(const void *, VISIT, int ));
#ifdef _GNU_SOURCE
#ifdef _DEFAULT_SOURCE
extern void tdestroy(void *root, void (*free_key)(void *));
#endif

View File

@ -70,7 +70,7 @@ extern FILE *fopen(const char *name, const char *mode);
extern FILE *freopen(const char *name, const char *mode, FILE *stream);
extern FILE *fdopen(int fd, const char *mode);
extern int fclose(FILE *stream);
#ifdef _GNU_SOURCE
#ifdef _DEFAULT_SOURCE
extern int fcloseall(void);
#endif
@ -103,7 +103,7 @@ extern FILE *fmemopen(void *buf, size_t size, const char *mode);
extern FILE *open_memstream(char **buf, size_t *size);
/* callback streams */
#ifdef _GNU_SOURCE
#ifdef _DEFAULT_SOURCE
typedef ssize_t (*cookie_read_function_t)(void *cookie, char *buf, size_t size);
typedef ssize_t (*cookie_write_function_t)(void *cookie, const char *buf, size_t size);
typedef ssize_t (*cookie_seek_function_t)(void *cookie, off_t *offset, int whence);
@ -115,7 +115,7 @@ typedef struct {
cookie_close_function_t *close;
} cookie_io_functions_t;
extern FILE *fopencookie(void *cookie, const char *mode, cookie_io_functions_t io_funcs);
#endif /*_GNU_SOURCE*/
#endif /* _DEFAULT_SOURCE */
/* file I/O */
extern int fflush(FILE *stream);

View File

@ -23,7 +23,7 @@ extern void *memccpy(void *dest, const void *source, int stopByte, size_t lengt
extern void *memmove(void *dest, const void *source, size_t length);
extern void *memset(void *dest, int value, size_t length);
#ifdef _GNU_SOURCE
#ifdef _DEFAULT_SOURCE
extern void *memrchr(const void *source, int value, size_t length);
#endif
@ -41,7 +41,7 @@ extern char *strchr(const char *string, int character);
extern char *strrchr(const char *string, int character);
extern char *strstr(const char *string, const char *searchString);
#ifdef _GNU_SOURCE
#ifdef _DEFAULT_SOURCE
extern char *strchrnul(const char *string, int character);
#endif

View File

@ -97,7 +97,7 @@ extern int wcscasecmp(const wchar_t *wcs1, const wchar_t *wcs2);
extern int wcscasecmp_l(const wchar_t *wcs1, const wchar_t *wcs2, locale_t locale);
extern wchar_t *wcscat(wchar_t *dest, const wchar_t *src);
extern wchar_t *wcschr(const wchar_t *wcs, wchar_t wc);
#ifdef _GNU_SOURCE
#ifdef _DEFAULT_SOURCE
extern wchar_t *wcschrnul(const wchar_t *wcs, wchar_t wc);
#endif
extern int wcscmp(const wchar_t *wcs1, const wchar_t *wcs2);
@ -149,7 +149,7 @@ extern wchar_t *wmemchr(const wchar_t *wcs, wchar_t wc, size_t n);
extern int wmemcmp(const wchar_t *wcs1, const wchar_t *wcs2, size_t n);
extern wchar_t *wmemcpy(wchar_t *dest, const wchar_t *src, size_t n);
extern wchar_t *wmemmove(wchar_t *dest, const wchar_t *src, size_t n);
#ifdef _GNU_SOURCE
#ifdef _DEFAULT_SOURCE
extern wchar_t *wmempcpy(wchar_t *dest, const wchar_t *src, size_t n);
#endif
extern wchar_t *wmemset(wchar_t *dest, wchar_t wc, size_t n);

View File

@ -9,7 +9,7 @@
#include <SupportDefs.h>
#define _GNU_SOURCE
#define _DEFAULT_SOURCE
#include <string.h>
#include "atombios.h"

View File

@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#define _GNU_SOURCE
#define _DEFAULT_SOURCE
#include <string.h>
/*

View File

@ -5,7 +5,7 @@
* for further information
*/
#define _GNU_SOURCE
#define _DEFAULT_SOURCE
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,4 +1,4 @@
#define _GNU_SOURCE
#define _DEFAULT_SOURCE
#include <string.h>
#include <stdint.h>
#include <limits.h>

View File

@ -1,4 +1,4 @@
#define _GNU_SOURCE
#define _DEFAULT_SOURCE
#include <string.h>
#define BITOP(a,b,op) \