Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify missing void parameter in function declarators #302

Merged
merged 2 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/darwintracelib1.0/darwintrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ volatile bool __darwintrace_initialized = false;
* interposed functions might end up being called first) we'll run them manually
* before we interpose anything.
*/
static void (*constructors[])() = {
static void (*constructors[])(void) = {
__darwintrace_setup_tls,
__darwintrace_store_env,
};

void __darwintrace_run_constructors() {
void __darwintrace_run_constructors(void) {
for (size_t i = 0; i < sizeof(constructors) / sizeof(*constructors); ++i) {
constructors[i]();
}
Expand All @@ -153,7 +153,7 @@ static void __darwintrace_sock_destructor(FILE *dtsock) {
* Setup method called as constructor to set up thread-local storage for the
* thread id and the darwintrace socket.
*/
void __darwintrace_setup_tls() {
void __darwintrace_setup_tls(void) {
if (0 != (errno = pthread_key_create(&tid_key, NULL))) {
perror("darwintrace: pthread_key_create");
abort();
Expand All @@ -176,7 +176,7 @@ static inline pthread_t __darwintrace_tid() {
/**
* Convenience setter function for the thread-local darwintrace socket
*/
static inline void __darwintrace_tid_set() {
static inline void __darwintrace_tid_set(void) {
if (0 != (errno = pthread_setspecific(tid_key, (const void *) pthread_self()))) {
perror("darwintrace: pthread_setspecific");
abort();
Expand Down Expand Up @@ -290,7 +290,7 @@ static inline char *__darwintrace_filemap_iter(char *command, filemap_iterator_t
* Request sandbox boundaries from tracelib (the MacPorts base-controlled side
* of the trace setup) and store it.
*/
static void __darwintrace_get_filemap() {
static void __darwintrace_get_filemap(void) {
char *newfilemap;
#if DARWINTRACE_DEBUG && 0
filemap_iterator_t it;
Expand Down Expand Up @@ -346,7 +346,7 @@ static void __darwintrace_get_filemap() {
* library and this library prevents closing the socket to MacPorts, we use \c
* __darwintrace_close_sock to allow closing specific FDs.
*/
void __darwintrace_close() {
void __darwintrace_close(void) {
FILE *dtsock = __darwintrace_sock();
if (dtsock) {
__darwintrace_close_sock = fileno(dtsock);
Expand All @@ -362,7 +362,7 @@ void __darwintrace_close() {
* called after \c fork(2), i.e. when the current PID doesn't match the one
* stored when the function was called last.
*/
void __darwintrace_setup() {
void __darwintrace_setup(void) {
/*
* Check whether this is a child process and we've inherited the socket. We
* want to avoid race conditions with our parent process when communicating
Expand Down Expand Up @@ -739,7 +739,7 @@ typedef struct {
*
* @return Pointer to the new path_t on success, NULL on error.
*/
static path_t *path_new() {
static path_t *path_new(void) {
path_t *path = NULL;

path = malloc(sizeof(path_t));
Expand Down
12 changes: 6 additions & 6 deletions src/darwintracelib1.0/darwintrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ extern FILE *__darwintrace_stderr;
* whether this process was fork(2)'d or clone(2)'d since the last call. Call
* this before calling any other functions from this library.
*/
void __darwintrace_setup();
void __darwintrace_setup(void);

/**
* Close the darwintrace socket and set it to \c NULL. Since this uses \c
* fclose(3), which internally calls \c close(2), which is intercepted by this
* library and this library prevents closing the socket to MacPorts, we use \c
* __darwintrace_close_sock to allow closing specific FDs.
*/
void __darwintrace_close();
void __darwintrace_close(void);

/**
* Check a path against the current sandbox
Expand Down Expand Up @@ -173,7 +173,7 @@ extern pthread_key_t sock_key;
* consider this part of public API. It is only needed to prevent closing and
* duplicating over darwintrace's socket FDs.
*/
static inline FILE *__darwintrace_sock() {
static inline FILE *__darwintrace_sock(void) {
return (FILE *) pthread_getspecific(sock_key);
}

Expand All @@ -192,18 +192,18 @@ static inline void __darwintrace_sock_set(FILE *stream) {
/**
* Initialize TLS variables.
*/
void __darwintrace_setup_tls();
void __darwintrace_setup_tls(void);

/**
* Grab environment variables at startup.
*/
void __darwintrace_store_env();
void __darwintrace_store_env(void);

/**
* Runs our "constructors". By this point all of the system libraries we link
* against should be fully initialized, so we can call their functions safely.
* Once our initialization is complete we may begin interposing.
*/
void __darwintrace_run_constructors() __attribute__((constructor));
void __darwintrace_run_constructors(void) __attribute__((constructor));

#endif /* defined(DARWINTRACE_USE_PRIVATE_API) */
2 changes: 1 addition & 1 deletion src/darwintracelib1.0/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static char *__env_full_darwintrace_log;
* Copy the environment variables, if they're defined. This is run as
* a constructor at startup.
*/
void __darwintrace_store_env() {
void __darwintrace_store_env(void) {
#define COPYENV(name, variable, valuevar) do {\
char *val;\
if (NULL != (val = getenv(#name))) {\
Expand Down
2 changes: 1 addition & 1 deletion src/machista1.0/tests/empty.c
Original file line number Diff line number Diff line change
@@ -1 +1 @@
void foo() {}
void foo(void) {}
2 changes: 1 addition & 1 deletion src/machista1.0/tests/libmachista-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ static bool test_format_dylib_version(void) {
}
#endif

int main() {
int main(void) {
#ifdef __MACH__
bool result = true;
result &= test_destroy_null();
Expand Down
4 changes: 2 additions & 2 deletions src/programs/daemondo/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,14 +408,14 @@ MonitorChild(pid_t childPid)


void
UnmonitorChild()
UnmonitorChild(void)
{
runningPid = 0;
}


int
MonitoringChild()
MonitoringChild(void)
{
return runningPid != 0;
}
Expand Down
Loading