diff options
author | Daniel Bertalan <dani@danielbertalan.dev> | 2022-01-08 15:32:59 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-01-08 19:22:00 +0100 |
commit | b9c753f6f9c0e738e671766c323aef82b6f04056 (patch) | |
tree | c997c9e6781fc58a8cfe47b054036d1bdb72c656 | |
parent | a221596614cde869d0b0ef1036c2a9e9ba48f0c5 (diff) | |
download | serenity-b9c753f6f9c0e738e671766c323aef82b6f04056.zip |
LibC+LibDl: Declare functions taking no arguments as taking void
In C++, a function declaration with an empty parameter list means that
the function takes no arguments. In C, however, it means that the
function takes an unspecified number of parameters.
What we did previously was therefore non-conforming. This caused a
config check to fail in the curl port, as it was able to redeclare
`rand` as taking an int parameter.
-rw-r--r-- | Userland/Libraries/LibC/bits/pthread_integration.h | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibC/float.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibC/grp.h | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibC/locale.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibC/net/if.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibC/netdb.h | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibC/pwd.h | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibC/sched.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibC/shadow.h | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibC/stdio.h | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibC/stdlib.h | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibC/sys/auxv.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibC/sys/internals.h | 16 | ||||
-rw-r--r-- | Userland/Libraries/LibC/time.h | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibC/unistd.h | 34 | ||||
-rw-r--r-- | Userland/Libraries/LibDl/dlfcn.h | 2 |
16 files changed, 56 insertions, 56 deletions
diff --git a/Userland/Libraries/LibC/bits/pthread_integration.h b/Userland/Libraries/LibC/bits/pthread_integration.h index f671cdf064..bbc7e820de 100644 --- a/Userland/Libraries/LibC/bits/pthread_integration.h +++ b/Userland/Libraries/LibC/bits/pthread_integration.h @@ -31,9 +31,9 @@ int __pthread_key_delete(pthread_key_t); void* __pthread_getspecific(pthread_key_t); int __pthread_setspecific(pthread_key_t, const void*); -int __pthread_self(); +int __pthread_self(void); -void __pthread_key_destroy_for_current_thread(); +void __pthread_key_destroy_for_current_thread(void); #define __PTHREAD_MUTEX_NORMAL 0 #define __PTHREAD_MUTEX_RECURSIVE 1 diff --git a/Userland/Libraries/LibC/float.h b/Userland/Libraries/LibC/float.h index e3843499c3..575278e24a 100644 --- a/Userland/Libraries/LibC/float.h +++ b/Userland/Libraries/LibC/float.h @@ -8,7 +8,7 @@ #pragma once // Defined in fenv.cpp, but we must not include fenv.h, so here's its prototype. -int fegetround(); +int fegetround(void); #define FLT_RADIX 2 #define DECIMAL_DIG 21 diff --git a/Userland/Libraries/LibC/grp.h b/Userland/Libraries/LibC/grp.h index 1acc7dee92..20df7747c7 100644 --- a/Userland/Libraries/LibC/grp.h +++ b/Userland/Libraries/LibC/grp.h @@ -20,9 +20,9 @@ struct group { char** gr_mem; }; -struct group* getgrent(); -void setgrent(); -void endgrent(); +struct group* getgrent(void); +void setgrent(void); +void endgrent(void); struct group* getgrnam(const char* name); struct group* getgrgid(gid_t); int putgrent(const struct group*, FILE*); diff --git a/Userland/Libraries/LibC/locale.h b/Userland/Libraries/LibC/locale.h index 2c9cfb2d4a..7d4069ecba 100644 --- a/Userland/Libraries/LibC/locale.h +++ b/Userland/Libraries/LibC/locale.h @@ -54,7 +54,7 @@ struct lconv { char int_n_sign_posn; }; -struct lconv* localeconv(); +struct lconv* localeconv(void); char* setlocale(int category, const char* locale); __END_DECLS diff --git a/Userland/Libraries/LibC/net/if.h b/Userland/Libraries/LibC/net/if.h index dd6a4ca97a..d96333a013 100644 --- a/Userland/Libraries/LibC/net/if.h +++ b/Userland/Libraries/LibC/net/if.h @@ -12,7 +12,7 @@ __BEGIN_DECLS unsigned int if_nametoindex(char const* ifname); char* if_indextoname(unsigned int ifindex, char* ifname); -struct if_nameindex* if_nameindex(); +struct if_nameindex* if_nameindex(void); void if_freenameindex(struct if_nameindex* ptr); __END_DECLS diff --git a/Userland/Libraries/LibC/netdb.h b/Userland/Libraries/LibC/netdb.h index 43ab958f1d..409be7d437 100644 --- a/Userland/Libraries/LibC/netdb.h +++ b/Userland/Libraries/LibC/netdb.h @@ -30,11 +30,11 @@ struct servent { char* s_proto; }; -struct servent* getservent(); +struct servent* getservent(void); struct servent* getservbyname(const char* name, const char* protocol); struct servent* getservbyport(int port, const char* protocol); void setservent(int stay_open); -void endservent(); +void endservent(void); struct protoent { char* p_name; @@ -42,10 +42,10 @@ struct protoent { int p_proto; }; -void endprotoent(); +void endprotoent(void); struct protoent* getprotobyname(const char* name); struct protoent* getprotobynumber(int proto); -struct protoent* getprotoent(); +struct protoent* getprotoent(void); void setprotoent(int stay_open); extern int h_errno; diff --git a/Userland/Libraries/LibC/pwd.h b/Userland/Libraries/LibC/pwd.h index e78ad50ab3..a7d8acd24c 100644 --- a/Userland/Libraries/LibC/pwd.h +++ b/Userland/Libraries/LibC/pwd.h @@ -22,9 +22,9 @@ struct passwd { char* pw_shell; }; -struct passwd* getpwent(); -void setpwent(); -void endpwent(); +struct passwd* getpwent(void); +void setpwent(void); +void endpwent(void); struct passwd* getpwnam(const char* name); struct passwd* getpwuid(uid_t); int putpwent(const struct passwd* p, FILE* stream); diff --git a/Userland/Libraries/LibC/sched.h b/Userland/Libraries/LibC/sched.h index 613dbc5602..db7ddc2cae 100644 --- a/Userland/Libraries/LibC/sched.h +++ b/Userland/Libraries/LibC/sched.h @@ -11,7 +11,7 @@ __BEGIN_DECLS -int sched_yield(); +int sched_yield(void); struct sched_param { int sched_priority; diff --git a/Userland/Libraries/LibC/shadow.h b/Userland/Libraries/LibC/shadow.h index ac58c0af40..2853db4b62 100644 --- a/Userland/Libraries/LibC/shadow.h +++ b/Userland/Libraries/LibC/shadow.h @@ -27,9 +27,9 @@ struct spwd { }; #ifndef AK_OS_MACOS -struct spwd* getspent(); -void setspent(); -void endspent(); +struct spwd* getspent(void); +void setspent(void); +void endspent(void); struct spwd* getspnam(const char* name); int putspent(struct spwd* p, FILE* stream); diff --git a/Userland/Libraries/LibC/stdio.h b/Userland/Libraries/LibC/stdio.h index b8879e4fb3..c1bf665d19 100644 --- a/Userland/Libraries/LibC/stdio.h +++ b/Userland/Libraries/LibC/stdio.h @@ -49,7 +49,7 @@ int fgetc(FILE*); int fgetc_unlocked(FILE*); int getc(FILE*); int getc_unlocked(FILE* stream); -int getchar(); +int getchar(void); ssize_t getdelim(char**, size_t*, int, FILE*); ssize_t getline(char**, size_t*, FILE*); int ungetc(int c, FILE*); @@ -94,7 +94,7 @@ int setvbuf(FILE*, char* buf, int mode, size_t); void setbuf(FILE*, char* buf); void setlinebuf(FILE*); int rename(const char* oldpath, const char* newpath); -FILE* tmpfile(); +FILE* tmpfile(void); char* tmpnam(char*); FILE* popen(const char* command, const char* type); int pclose(FILE*); diff --git a/Userland/Libraries/LibC/stdlib.h b/Userland/Libraries/LibC/stdlib.h index 68caf7a3cb..abab2a44cb 100644 --- a/Userland/Libraries/LibC/stdlib.h +++ b/Userland/Libraries/LibC/stdlib.h @@ -16,7 +16,7 @@ __BEGIN_DECLS #define EXIT_SUCCESS 0 #define EXIT_FAILURE 1 -__attribute__((noreturn)) void _abort(); +__attribute__((noreturn)) void _abort(void); __attribute__((malloc)) __attribute__((alloc_size(1))) void* malloc(size_t); __attribute__((malloc)) __attribute__((alloc_size(1, 2))) void* calloc(size_t nmemb, size_t); @@ -33,7 +33,7 @@ int putenv(char*); int unsetenv(const char*); int clearenv(void); int setenv(const char* name, const char* value, int overwrite); -const char* getprogname(); +const char* getprogname(void); void setprogname(const char*); int atoi(const char*); long atol(const char*); @@ -47,9 +47,9 @@ unsigned long long strtoull(const char*, char** endptr, int base); unsigned long strtoul(const char*, char** endptr, int base); void qsort(void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*)); void qsort_r(void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*, void*), void* arg); -int atexit(void (*function)()); +int atexit(void (*function)(void)); __attribute__((noreturn)) void exit(int status); -__attribute__((noreturn)) void abort(); +__attribute__((noreturn)) void abort(void); char* ptsname(int fd); int ptsname_r(int fd, char* buffer, size_t); int abs(int); @@ -70,10 +70,10 @@ char* realpath(const char* pathname, char* buffer); __attribute__((noreturn)) void _Exit(int status); #define RAND_MAX 32767 -int rand(); +int rand(void); void srand(unsigned seed); -long int random(); +long int random(void); void srandom(unsigned seed); uint32_t arc4random(void); diff --git a/Userland/Libraries/LibC/sys/auxv.h b/Userland/Libraries/LibC/sys/auxv.h index 28da5da4e7..750383126c 100644 --- a/Userland/Libraries/LibC/sys/auxv.h +++ b/Userland/Libraries/LibC/sys/auxv.h @@ -43,7 +43,7 @@ typedef struct union { long a_val; void* a_ptr; - void (*a_fnc)(); /* In spec, not used */ + void (*a_fnc)(void); /* In spec, not used */ } a_un; } auxv_t; diff --git a/Userland/Libraries/LibC/sys/internals.h b/Userland/Libraries/LibC/sys/internals.h index 4a275b2801..2b1b9a795d 100644 --- a/Userland/Libraries/LibC/sys/internals.h +++ b/Userland/Libraries/LibC/sys/internals.h @@ -12,11 +12,11 @@ __BEGIN_DECLS typedef void (*AtExitFunction)(void*); -extern void __libc_init(); -extern void __malloc_init(); -extern void __stdio_init(); -extern void __begin_atexit_locking(); -extern void _init(); +extern void __libc_init(void); +extern void __malloc_init(void); +extern void __stdio_init(void); +extern void __begin_atexit_locking(void); +extern void _init(void); extern bool __environ_is_malloced; extern bool __stdio_is_initialized; extern bool __heap_is_stable; @@ -24,8 +24,8 @@ extern void* __auxiliary_vector; int __cxa_atexit(AtExitFunction exit_function, void* parameter, void* dso_handle); void __cxa_finalize(void* dso_handle); -__attribute__((noreturn)) void __cxa_pure_virtual() __attribute__((weak)); -__attribute__((noreturn)) void __stack_chk_fail(); -__attribute__((noreturn)) void __stack_chk_fail_local(); +__attribute__((noreturn)) void __cxa_pure_virtual(void) __attribute__((weak)); +__attribute__((noreturn)) void __stack_chk_fail(void); +__attribute__((noreturn)) void __stack_chk_fail_local(void); __END_DECLS diff --git a/Userland/Libraries/LibC/time.h b/Userland/Libraries/LibC/time.h index 4d41ffec0b..d5316c4ee4 100644 --- a/Userland/Libraries/LibC/time.h +++ b/Userland/Libraries/LibC/time.h @@ -37,11 +37,11 @@ time_t timegm(struct tm*); time_t time(time_t*); char* ctime(const time_t*); char* ctime_r(const time_t* tm, char* buf); -void tzset(); +void tzset(void); char* asctime(const struct tm*); char* asctime_r(const struct tm*, char* buf); -clock_t clock(); +clock_t clock(void); int clock_gettime(clockid_t, struct timespec*); int clock_settime(clockid_t, struct timespec*); diff --git a/Userland/Libraries/LibC/unistd.h b/Userland/Libraries/LibC/unistd.h index b12cc237af..141ae5e517 100644 --- a/Userland/Libraries/LibC/unistd.h +++ b/Userland/Libraries/LibC/unistd.h @@ -32,13 +32,13 @@ extern char** environ; int get_process_name(char* buffer, int buffer_size); int set_process_name(const char* name, size_t name_length); -void dump_backtrace(); +void dump_backtrace(void); int fsync(int fd); -int sysbeep(); -int gettid(); -int getpagesize(); -pid_t fork(); -pid_t vfork(); +int sysbeep(void); +int gettid(void); +int getpagesize(void); +pid_t fork(void); +pid_t vfork(void); int execv(const char* path, char* const argv[]); int execve(const char* filename, char* const argv[], char* const envp[]); int execvpe(const char* filename, char* const argv[], char* const envp[]); @@ -46,19 +46,19 @@ int execvp(const char* filename, char* const argv[]); int execl(const char* filename, const char* arg, ...); int execle(const char* filename, const char* arg, ...); int execlp(const char* filename, const char* arg, ...); -void sync(); +void sync(void); __attribute__((noreturn)) void _exit(int status); pid_t getsid(pid_t); -pid_t setsid(); +pid_t setsid(void); int setpgid(pid_t pid, pid_t pgid); pid_t getpgid(pid_t); -pid_t getpgrp(); -uid_t geteuid(); -gid_t getegid(); -uid_t getuid(); -gid_t getgid(); -pid_t getpid(); -pid_t getppid(); +pid_t getpgrp(void); +uid_t geteuid(void); +gid_t getegid(void); +uid_t getuid(void); +gid_t getgid(void); +pid_t getpid(void); +pid_t getppid(void); int getresuid(uid_t*, uid_t*, uid_t*); int getresgid(gid_t*, gid_t*, gid_t*); int getgroups(int size, gid_t list[]); @@ -103,7 +103,7 @@ int isatty(int fd); int mknod(const char* pathname, mode_t, dev_t); long fpathconf(int fd, int name); long pathconf(const char* path, int name); -char* getlogin(); +char* getlogin(void); int lchown(const char* pathname, uid_t uid, gid_t gid); int chown(const char* pathname, uid_t, gid_t); int fchown(int fd, uid_t, gid_t); @@ -115,7 +115,7 @@ int umount(const char* mountpoint); int pledge(const char* promises, const char* execpromises); int unveil(const char* path, const char* permissions); char* getpass(const char* prompt); -int pause(); +int pause(void); int chroot(const char*); enum { diff --git a/Userland/Libraries/LibDl/dlfcn.h b/Userland/Libraries/LibDl/dlfcn.h index 880dce74ac..b8ab808793 100644 --- a/Userland/Libraries/LibDl/dlfcn.h +++ b/Userland/Libraries/LibDl/dlfcn.h @@ -24,7 +24,7 @@ typedef struct __Dl_info { } Dl_info; int dlclose(void*); -char* dlerror(); +char* dlerror(void); void* dlopen(const char*, int); void* dlsym(void*, const char*); int dladdr(void*, Dl_info*); |