Use (void) rather than () in function declarations

In C, a function declaration with () allows any set of arguments.
Use (void) to mean "no arguments".

* src/dep.h: Switch () to (void) for functions with no arguments.
* src/makeint.h: Ditto.
* src/os.h: Ditto.
* src/shuffle.h: Ditto.
* src/variable.h: Ditto.
This commit is contained in:
Paul Smith 2022-10-15 17:03:21 -04:00
parent 18c4b508ef
commit c453f898a0
5 changed files with 34 additions and 35 deletions

View File

@ -102,24 +102,23 @@ char *tilde_expand (const char *name);
struct nameseq *ar_glob (const char *arname, const char *member_pattern, size_t size);
#endif
#define dep_name(d) ((d)->name ? (d)->name : (d)->file->name)
#define dep_name(d) ((d)->name ? (d)->name : (d)->file->name)
#define alloc_seq_elt(_t) xcalloc (sizeof (_t))
#define alloc_seq_elt(_t) xcalloc (sizeof (_t))
void free_ns_chain (struct nameseq *n);
#if defined(MAKE_MAINTAINER_MODE) && defined(__GNUC__) && !defined(__STRICT_ANSI__)
/* Use inline to get real type-checking. */
#define SI static inline
SI struct nameseq *alloc_ns() { return alloc_seq_elt (struct nameseq); }
SI struct dep *alloc_dep() { return alloc_seq_elt (struct dep); }
SI struct goaldep *alloc_goaldep() { return alloc_seq_elt (struct goaldep); }
SI struct nameseq *alloc_ns (void) { return alloc_seq_elt (struct nameseq); }
SI struct dep *alloc_dep (void) { return alloc_seq_elt (struct dep); }
SI struct goaldep *alloc_goaldep (void) { return alloc_seq_elt (struct goaldep); }
SI void free_ns(struct nameseq *n) { free (n); }
SI void free_dep(struct dep *d) { free_ns ((struct nameseq *)d); }
SI void free_goaldep(struct goaldep *g) { free_dep ((struct dep *)g); }
SI void free_dep_chain(struct dep *d) { free_ns_chain((struct nameseq *)d); }
SI void free_goal_chain(struct goaldep *g) { free_dep_chain((struct dep *)g); }
SI void free_ns (struct nameseq *n) { free (n); }
SI void free_dep (struct dep *d) { free_ns ((struct nameseq *)d); }
SI void free_goaldep (struct goaldep *g) { free_dep ((struct dep *)g); }
SI void free_dep_chain (struct dep *d) { free_ns_chain((struct nameseq *)d); }
SI void free_goal_chain (struct goaldep *g) { free_dep_chain((struct dep *)g); }
#else
# define alloc_ns() alloc_seq_elt (struct nameseq)
# define alloc_dep() alloc_seq_elt (struct dep)

View File

@ -526,7 +526,7 @@ void error (const floc *flocp, size_t length, const char *fmt, ...)
ATTRIBUTE ((__format__ (__printf__, 3, 4)));
void fatal (const floc *flocp, size_t length, const char *fmt, ...)
ATTRIBUTE ((noreturn, __format__ (__printf__, 3, 4)));
void out_of_memory () NORETURN;
void out_of_memory (void) NORETURN;
/* When adding macros to this list be sure to update the value of
XGETTEXT_OPTIONS in the po/Makevars file. */
@ -554,8 +554,8 @@ unsigned int make_toui (const char*, const char**);
char *make_lltoa (long long, char *);
char *make_ulltoa (unsigned long long, char *);
void make_seed (unsigned int);
unsigned int make_rand ();
pid_t make_pid ();
unsigned int make_rand (void);
pid_t make_pid (void);
void *xmalloc (size_t);
void *xcalloc (size_t);
void *xrealloc (void *, size_t);
@ -570,7 +570,7 @@ int alpha_compare (const void *, const void *);
void print_spaces (unsigned int);
char *find_percent (char *);
const char *find_percent_cached (const char **);
char *get_tmppath ();
char *get_tmppath (void);
int get_tmpfd (char **);
FILE *get_tmpfile (char **);
ssize_t writebuf (int, const void *, size_t);
@ -661,10 +661,10 @@ long int lseek ();
# ifdef HAVE_GETCWD
# if !defined(VMS) && !defined(__DECC)
char *getcwd ();
char *getcwd (void);
# endif
# else
char *getwd ();
char *getwd (void);
# define getcwd(buf, len) getwd (buf)
# endif

View File

@ -29,7 +29,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#else
/* Determine the state of stdin/stdout/stderr. */
unsigned int check_io_state ();
unsigned int check_io_state (void);
/* Set a file descriptor to close/not close in a subprocess. */
void fd_inherit (int);
@ -41,7 +41,7 @@ void fd_set_append (int);
/* Return a file descriptor for a new anonymous temp file, or -1. */
#if defined(WINDOWS32)
int os_anontmp ();
int os_anontmp (void);
#else
# define os_anontmp() (-1)
#endif
@ -51,7 +51,7 @@ int os_anontmp ();
#ifdef MAKE_JOBSERVER
/* Returns 1 if the jobserver is enabled, else 0. */
unsigned int jobserver_enabled ();
unsigned int jobserver_enabled (void);
/* Called in the parent make to set up the jobserver initially. */
unsigned int jobserver_setup (int job_slots, const char *style);
@ -61,25 +61,25 @@ unsigned int jobserver_setup (int job_slots, const char *style);
unsigned int jobserver_parse_auth (const char* auth);
/* Returns an allocated buffer used to pass to child instances. */
char *jobserver_get_auth ();
char *jobserver_get_auth (void);
/* Returns a pointer to a static string used to indicate that the child
cannot access the jobserver, or NULL if it always can. */
const char *jobserver_get_invalid_auth ();
const char *jobserver_get_invalid_auth (void);
/* Clear this instance's jobserver configuration.
This method might be invoked from a signal handler. */
void jobserver_clear ();
void jobserver_clear (void);
/* Recover all the jobserver tokens and return the number we got.
Will also run jobserver_clear() as a side-effect. */
unsigned int jobserver_acquire_all ();
unsigned int jobserver_acquire_all (void);
/* Release a jobserver token. If it fails and is_fatal is 1, fatal. */
void jobserver_release (int is_fatal);
/* Notify the jobserver that a child exited. */
void jobserver_signal ();
void jobserver_signal (void);
/* Get ready to start a non-recursive child. */
void jobserver_pre_child (int);
@ -88,7 +88,7 @@ void jobserver_pre_child (int);
void jobserver_post_child (int);
/* Set up to acquire a new token. */
void jobserver_pre_acquire ();
void jobserver_pre_acquire (void);
/* Wait until we can acquire a jobserver token.
TIMEOUT is 1 if we have other jobs waiting for the load to go down;
@ -118,14 +118,14 @@ unsigned int jobserver_acquire (int timeout);
#ifndef NO_OUTPUT_SYNC
/* Returns 1 if output sync is enabled, else 0. */
unsigned int osync_enabled ();
unsigned int osync_enabled (void);
/* Called in the parent make to set up output sync initially. */
void osync_setup ();
void osync_setup (void);
/* Returns an allocated buffer containing output sync info to pass to child
instances, or NULL if not needed. */
char *osync_get_mutex ();
char *osync_get_mutex (void);
/* Called in a child instance to obtain info on the output sync mutex.
Return 1 if we got a valid mutex, else 0. */
@ -133,14 +133,14 @@ unsigned int osync_parse_mutex (const char *mutex);
/* Clean up this instance's output sync facilities.
This method might be invoked from a signal handler. */
void osync_clear ();
void osync_clear (void);
/* Acquire the output sync lock. This will wait until available.
Returns 0 if there was an error getting the semaphore. */
unsigned int osync_acquire ();
unsigned int osync_acquire (void);
/* Release the output sync lock. */
void osync_release ();
void osync_release (void);
#else
@ -158,5 +158,5 @@ void osync_release ();
#if defined(VMS) || defined(WINDOWS32) || defined(_AMIGA) || defined(__MSDOS__)
# define get_bad_stdin() (-1)
#else
int get_bad_stdin ();
int get_bad_stdin (void);
#endif

View File

@ -18,7 +18,7 @@ struct dep;
struct goaldep;
void shuffle_set_mode (const char *cmdarg);
const char * shuffle_get_mode ();
const char *shuffle_get_mode (void);
void shuffle_deps_recursive (struct dep* g);
#define shuffle_goaldeps_recursive(_g) do{ \

View File

@ -133,7 +133,7 @@ char *allocated_variable_expand_for_file (const char *line, struct file *file);
allocated_variable_expand_for_file (line, (struct file *) 0)
char *expand_argument (const char *str, const char *end);
char *variable_expand_string (char *line, const char *string, size_t length);
char *initialize_variable_output ();
char *initialize_variable_output (void);
void install_variable_buffer (char **bufp, size_t *lenp);
void restore_variable_buffer (char *buf, size_t len);