add C++ header guards

This commit is contained in:
Lephenixnoir 2021-06-28 15:49:05 +02:00
parent f5571e2b3d
commit a6dbcfb227
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495
20 changed files with 167 additions and 2 deletions

View file

@ -9,6 +9,10 @@
#define __ASSERT_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Internal function that prints error message and aborts */
void __assert_fail(char const *__file, int __line, char const *__function,
char const *__expression);
@ -25,3 +29,7 @@ void __assert_fail(char const *__file, int __line, char const *__function,
#ifndef __cplusplus
# define static_assert _Static_assert
#endif
#ifdef __cplusplus
}
#endif

View file

@ -1,6 +1,10 @@
#ifndef __CTYPE_H__
# define __CTYPE_H__
#ifdef __cplusplus
extern "C" {
#endif
/*
** Character classification functions. These are all implemented as sets of
** comparisons. There is an approach with a 128-byte table, but it takes more
@ -103,4 +107,8 @@ extern int toupper(int c);
islower(__c0) ? (__c0 & 0xdf) : __c0; \
})
#ifdef __cplusplus
}
#endif
#endif /*__CTYPE_H__*/

View file

@ -1,6 +1,10 @@
#ifndef __ERRNO_H__
# define __ERRNO_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Initialized to 0 at startup. Currently not TLS, maybe in the future if
threads are supported. */
extern int errno;
@ -9,4 +13,8 @@ extern int errno;
#define EILSEQ 2
#define ERANGE 3
#ifdef __cplusplus
}
#endif
#endif /*__ERRNO_H__*/

View file

@ -1,6 +1,10 @@
#ifndef __FCNTL_H__
# define __FCNTL_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#include <stdint.h>
@ -17,4 +21,8 @@
*/
extern int open(const char *pathname, int flags, ...);
#ifdef __cplusplus
}
#endif
#endif /*__FCNTL_H__*/

View file

@ -1,6 +1,10 @@
#ifndef __FXLIBC_PRINTF_H__
# define __FXLIBC_PRINTF_H__
#ifdef __cplusplus
extern "C" {
#endif
/*
** This headers covers fxlibc-specific extensions to the *printf API. fxlibc
** provides an interface to define new converters, and a number of helpers to
@ -268,4 +272,8 @@ extern int __printf_digits16(char *__str, int uppercase, uint64_t __n);
/* Same in base 8. */
extern int __printf_digits8(char *__str, uint64_t __n);
#ifdef __cplusplus
}
#endif
#endif /*__FXLIBC_PRINTF_H__*/

View file

@ -1,6 +1,10 @@
#ifndef __INTTYPES_H__
# define __INTTYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdlib.h>
@ -255,4 +259,8 @@ extern uintmax_t strtoumax(
char ** __restrict__ __endptr,
int __base);
#ifdef __cplusplus
}
#endif
#endif /*__INTTYPES_H__*/

View file

@ -1,6 +1,10 @@
#ifndef __LOCALE_H__
# define __LOCALE_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
struct lconv {
@ -40,4 +44,8 @@ struct lconv {
extern char *setlocale(int __category, char const *__locale);
extern struct lconv *localeconv(void);
#ifdef __cplusplus
}
#endif
#endif /*__LOCALE_H__*/

View file

@ -1,6 +1,10 @@
#ifndef __SETJMP_H__
# define __SETJMP_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#include <stdint.h>
#include <bits/setjmp.h>
@ -19,4 +23,8 @@ extern int setjmp(jmp_buf __env);
__attribute__((noreturn))
extern void longjmp(jmp_buf __env, int __val);
#ifdef __cplusplus
}
#endif
#endif /*__SETJMP_H__*/

View file

@ -1,6 +1,10 @@
#ifndef __SIGNAL_H__
# define __SIGNAL_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#include <stdint.h>
#include <stdatomic.h>
@ -48,4 +52,8 @@ extern int kill(pid_t __pid, int __sig);
#endif /*_POSIX_C_SOURCE*/
#ifdef __cplusplus
}
#endif
#endif /*__SIGNAL_H__*/

View file

@ -1,6 +1,10 @@
#ifndef __STDIO_H__
# define __STDIO_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#include <stdarg.h>
@ -132,4 +136,8 @@ extern int asprintf(char ** __restrict__ __str,
extern int vasprintf(char ** __restrict__ __str,
char const * __restrict__ __format, va_list __args);
#ifdef __cplusplus
}
#endif
#endif /*__STDIO_H__*/

View file

@ -1,6 +1,10 @@
#ifndef __STDLIB_H__
# define __STDLIB_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#include <stdint.h>
#include <bits/exit.h>
@ -143,4 +147,13 @@ extern void srand(unsigned int seed);
/* Generate a pseudo-random number between 0 and RAND_MAX. */
extern int rand(void);
/* Searching and sorting utilities. */
void qsort(void *base, size_t nmemb, size_t size,
int (*compare)(void const *left, void const *right));
#ifdef __cplusplus
}
#endif
#endif /*__STDLIB_H__*/

View file

@ -1,6 +1,10 @@
#ifndef __STRING_H__
# define __STRING_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
/* Copying functions. */
@ -109,4 +113,8 @@ extern char *strdup(char const *__s);
/* Duplicate at most __n characters of __s with malloc. */
extern char *strndup(char const *__s, size_t __n);
#ifdef __cplusplus
}
#endif
#endif /*__STRING_H__*/

View file

@ -1,6 +1,10 @@
#ifndef __SYS_MMAN_H__
# define __SYS_MMAN_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#include <stdint.h>
@ -55,4 +59,8 @@ extern void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t
*/
extern int munmap(void *addr, size_t length);
#ifdef __cplusplus
}
#endif
#endif /*__SYS_MMAN_H__*/

View file

@ -1,6 +1,10 @@
#ifndef __SYS_STAT_H__
# define __SYS_STAT_H__
#ifdef __cplusplus
extern "C" {
#endif
/* File types. */
#define __S_IFMT 0170000 /* These bits determine file type. */
#define __S_IFDIR 0040000 /* Directory. */
@ -37,4 +41,8 @@
/* Read, write, and execute by others. */
#define S_IRWXO (S_IRWXG >> 3)
#ifdef __cplusplus
}
#endif
#endif /*__SYS_STAT_H__*/

View file

@ -1,6 +1,10 @@
#ifndef __SYS_SYSCALL_H__
# define __SYS_SYSCALL_H__
#ifdef __cplusplus
extern "C" {
#endif
/*
** This file should list the numbers of the system calls the system knows.
** But instead of duplicating this we use the information available
@ -15,4 +19,8 @@
*/
#include <bits/syscall.h>
#ifdef __cplusplus
}
#endif
#endif /*__SYS_SYSCALL_H__*/

View file

@ -1,6 +1,10 @@
#ifndef __SYS_TYPES_H__
# define __SYS_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#include <stdint.h>
@ -23,4 +27,8 @@ typedef int16_t mode_t;
typedef uint16_t dev_t;
typedef uint16_t umode_t;
#ifdef __cplusplus
}
#endif
#endif /*__SYS_TYPES_H__*/

View file

@ -1,6 +1,10 @@
#ifndef __SYS_WAIT_H__
# define __SYS_WAIT_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#include <stdint.h>
#include <sys/types.h>
@ -46,4 +50,8 @@ extern pid_t waitpid(pid_t pid, int *wstatus, int options);
*/
extern pid_t wait(int *wstatus);
#ifdef __cplusplus
}
#endif
#endif /*__SYS_WAIT_H__*/

View file

@ -1,6 +1,10 @@
#ifndef __THREADS_H__
# define __THREADS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#include <stdint.h>
@ -74,4 +78,8 @@ extern uint32_t __thread_atomic_start(void);
*/
extern uint32_t __thread_atomic_stop(void);
#ifdef __cplusplus
}
#endif
#endif /*__THREADS_H__*/

View file

@ -1,6 +1,10 @@
#ifndef __TIME_H__
# define __TIME_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Number of ticks per second in a clock_t value. */
#define CLOCKS_PER_SEC 1000000
@ -23,4 +27,8 @@ struct tm {
int tm_isdst;
};
#ifdef __cplusplus
}
#endif
#endif /*__TIME_H__*/

View file

@ -1,6 +1,10 @@
#ifndef __UNISTD_H__
# define __UNISTD_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#include <stdint.h>
@ -83,4 +87,8 @@ extern int close(int __fd);
/* Get the value of the system variable NAME. */
extern long int sysconf(int __name);
#ifdef __cplusplus
}
#endif
#endif /*__UNISTD_H__*/