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.
This commit is contained in:
Daniel Bertalan 2022-01-08 15:32:59 +01:00 committed by Linus Groh
parent a221596614
commit b9c753f6f9
Notes: sideshowbarker 2024-07-19 01:59:31 +09:00
16 changed files with 56 additions and 56 deletions

View file

@ -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

View file

@ -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

View file

@ -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*);

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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);

View file

@ -11,7 +11,7 @@
__BEGIN_DECLS
int sched_yield();
int sched_yield(void);
struct sched_param {
int sched_priority;

View file

@ -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);

View file

@ -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*);

View file

@ -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);

View file

@ -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;

View file

@ -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

View file

@ -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*);

View file

@ -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 {

View file

@ -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*);