Skip to content

Commit

Permalink
C89: Assume RETSIGTYPE void and SIGNAL_RETURN return
Browse files Browse the repository at this point in the history
We can safely assume that this is true on any supported platform.

Signed-off-by: Matt Jolly <kangie@gentoo.org>
  • Loading branch information
Kangie committed Oct 27, 2024
1 parent ca2d25a commit 0fab71f
Show file tree
Hide file tree
Showing 25 changed files with 73 additions and 80 deletions.
5 changes: 0 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1289,11 +1289,6 @@ AH_VERBATIM([_ZEND_EXPLICIT_DEFINITIONS],
#define FMiniIconsSupported 0
#endif
#if RETSIGTYPE != void
#define SIGNAL_RETURN return 0
#else
#define SIGNAL_RETURN return
#endif
/* Allow GCC extensions to work, if you have GCC. */
#ifndef __attribute__
Expand Down
12 changes: 6 additions & 6 deletions fvwm/fvwm3.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ static void catch_exit(void)
/*
* Restart on a signal
*/
static RETSIGTYPE
static void
Restart(int sig)
{
fvwmRunState = FVWM_RESTART;
Expand All @@ -286,18 +286,18 @@ Restart(int sig)
* BEFORE we call it ... */
fvwmSetTerminate(sig);

SIGNAL_RETURN;
return;
}

static RETSIGTYPE
static void
ToggleLogging(int sig)
{
log_toggle(fvwm_userdir);

SIGNAL_RETURN;
return;
}

static RETSIGTYPE
static void
SigDone(int sig)
{
fvwmRunState = FVWM_DONE;
Expand All @@ -307,7 +307,7 @@ SigDone(int sig)
* BEFORE we call it ... */
fvwmSetTerminate(sig);

SIGNAL_RETURN;
return;
}

/*
Expand Down
4 changes: 2 additions & 2 deletions fvwm/module_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -1054,9 +1054,9 @@ void FlushAllMessageQueues(void)

/* empty, only here so that the signal handling initialization code is the
* same for modules and fvwm */
RETSIGTYPE DeadPipe(int sig)
void DeadPipe(int sig)
{
SIGNAL_RETURN;
return;
}

void CMD_Module(F_CMD_ARGS)
Expand Down
2 changes: 1 addition & 1 deletion fvwm/module_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,6 @@ char *skipModuleAliasToken(const char *string);


/* dead pipe signal handler - empty */
RETSIGTYPE DeadPipe(int nonsense);
void DeadPipe(int nonsense);

#endif /* MODULE_LIST_H */
2 changes: 1 addition & 1 deletion libs/PictureImageLoader.c
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ Bool PImageLoadXpm(FIMAGE_CMD_ARGS)
struct sigaction defaultHandler;
struct sigaction originalHandler;
#else
RETSIGTYPE (*originalHandler)(int);
void (*originalHandler)(int);
#endif

if (!XpmSupport)
Expand Down
4 changes: 2 additions & 2 deletions libs/fvwmsignal.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static jmp_buf deadJump;
* We do this asynchronously within the SIGCHLD handler so that
* "it just happens".
*/
RETSIGTYPE
void
fvwmReapChildren(int sig)
{
(void)sig;
Expand Down Expand Up @@ -79,7 +79,7 @@ fvwmReapChildren(int sig)
#endif
BSD_UNBLOCK_SIGNALS;

SIGNAL_RETURN;
return;
}

#ifdef USE_BSD_SIGNALS
Expand Down
2 changes: 1 addition & 1 deletion libs/fvwmsignal.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extern volatile sig_atomic_t isTerminated;
/*
* Module prototypes
*/
RETSIGTYPE fvwmReapChildren(int sig);
void fvwmReapChildren(int sig);
extern void fvwmSetTerminate(int sig);

#ifdef USE_BSD_SIGNALS
Expand Down
2 changes: 0 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ conf.set_quoted(
conf.set_quoted('FVWM_DATADIR', fvwm_datadir)
conf.set_quoted('LOCALEDIR', prefix / get_option('localedir'))
conf.set_quoted('FVWM_CONFDIR', prefix / get_option('sysconfdir'))
conf.set('RETSIGTYPE', 'void')
conf.set('SIGNAL_RETURN', 'return')
conf.set('ICONV_ARG_CONST', '')
conf.set('fd_set_size_t', 'int')
conf.set('EXECUTABLE_EXTENSION', 'NULL')
Expand Down
8 changes: 4 additions & 4 deletions modules/FvwmAnimate/FvwmAnimate.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ static void AnimateResizeNone(int, int, int, int, int, int, int, int);
static void AnimateResizeTwist(int, int, int, int, int, int, int, int);
static void DefineForm(void);

static RETSIGTYPE HandleTerminate(int sig);
static void HandleTerminate(int sig);

struct ASAnimate Animate = { NULL, NULL, ANIM_ITERATIONS, ANIM_DELAY,
ANIM_TWIST, ANIM_WIDTH,
Expand Down Expand Up @@ -748,14 +748,14 @@ void
DeadPipe(int arg) {
myfprintf((stderr,"Dead Pipe, arg %d\n",arg));
exit(0);
SIGNAL_RETURN;
return;
}


static RETSIGTYPE
static void
HandleTerminate(int sig) {
fvwmSetTerminate(sig);
SIGNAL_RETURN;
return;
}


Expand Down
10 changes: 5 additions & 5 deletions modules/FvwmAuto/FvwmAuto.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,20 @@
#endif


static RETSIGTYPE TerminateHandler(int signo);
static void TerminateHandler(int signo);

/*
*
* Procedure:
* Termination procedure : *not* a signal handler
*
*/
RETSIGTYPE DeadPipe(int nonsense)
void DeadPipe(int nonsense)
{
(void)nonsense;
myfprintf((stderr,"Leaving via DeadPipe\n"));
exit(0);
SIGNAL_RETURN;
return;
}

/*
Expand All @@ -84,11 +84,11 @@ RETSIGTYPE DeadPipe(int nonsense)
* Signal handler that tells the module to quit
*
*/
static RETSIGTYPE
static void
TerminateHandler(int signo)
{
fvwmSetTerminate(signo);
SIGNAL_RETURN;
return;
}

/*
Expand Down
4 changes: 2 additions & 2 deletions modules/FvwmBacker/FvwmBacker.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,10 @@ void ProcessMessage(unsigned long type, unsigned long *body)
/*
Detected a broken pipe - time to exit
*/
RETSIGTYPE DeadPipe(int nonsense)
void DeadPipe(int nonsense)
{
exit(1);
SIGNAL_RETURN;
return;
}

/*
Expand Down
2 changes: 1 addition & 1 deletion modules/FvwmBacker/FvwmBacker.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
void EndLessLoop(void);
void ReadFvwmPipe(void);
void ProcessMessage(unsigned long type, unsigned long *body);
RETSIGTYPE DeadPipe(int nonsense);
void DeadPipe(int nonsense);
void ParseConfig(void);
int ParseConfigLine(char *line);
void AddCommand(char *line);
Expand Down
12 changes: 6 additions & 6 deletions modules/FvwmButtons/FvwmButtons.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ extern void SaveButtons(button_info *);

/* ------------------------------ prototypes ------------------------------- */

RETSIGTYPE DeadPipe(int nonsense);
void DeadPipe(int nonsense);
static void DeadPipeCleanup(void);
static RETSIGTYPE TerminateHandler(int sig);
static void TerminateHandler(int sig);
void SetButtonSize(button_info *, int, int);
/* main */
void Loop(void);
Expand Down Expand Up @@ -219,21 +219,21 @@ int IsThereADestroyEvent(button_info *b)
*** Externally callable function to quit! Note that DeadPipeCleanup
*** is an exit-procedure and so will be called automatically
**/
RETSIGTYPE DeadPipe(int whatever)
void DeadPipe(int whatever)
{
exit(0);
SIGNAL_RETURN;
return;
}

/**
*** TerminateHandler()
*** Signal handler that will make the event-loop terminate
**/
static RETSIGTYPE
static void
TerminateHandler(int sig)
{
fvwmSetTerminate(sig);
SIGNAL_RETURN;
return;
}

/**
Expand Down
14 changes: 7 additions & 7 deletions modules/FvwmConsole/FvwmConsole.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ char Name[80]; /* name of this program in executable format */
char *S_name = NULL; /* socket name */

void server(void);
RETSIGTYPE DeadPipe(int);
void DeadPipe(int);
void ErrMsg(char *msg);
void SigHandler(int);

Expand All @@ -64,27 +64,27 @@ void clean_up(void)
/*
* signal handler
*/
RETSIGTYPE DeadPipe(int dummy)
void DeadPipe(int dummy)
{
clean_up();
exit(0);

SIGNAL_RETURN;
return;
}

RETSIGTYPE SigHandler(int dummy)
void SigHandler(int dummy)
{
clean_up();
exit(0);

SIGNAL_RETURN;
return;
}

RETSIGTYPE ReapChildren(int sig)
void ReapChildren(int sig)
{
fvwmReapChildren(sig);

SIGNAL_RETURN;
return;
}

int main(int argc, char *argv[])
Expand Down
6 changes: 3 additions & 3 deletions modules/FvwmConsole/FvwmConsoleC.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ void sclose(int foo)
}
exit(0);

SIGNAL_RETURN;
return;
}

RETSIGTYPE ReapChildren(int sig)
void ReapChildren(int sig)
{
fvwmReapChildren(sig);
sclose(sig);

SIGNAL_RETURN;
return;
}

/*
Expand Down
12 changes: 6 additions & 6 deletions modules/FvwmEvent/FvwmEvent.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ typedef struct

void execute_event(event_entry*, short, unsigned long*);
void config(void);
RETSIGTYPE DeadPipe(int);
static RETSIGTYPE TerminateHandler(int);
void DeadPipe(int);
static void TerminateHandler(int);

/* ---------------------------- local variables ----------------------------- */

Expand Down Expand Up @@ -679,12 +679,12 @@ void config(void)
* SIGPIPE handler - SIGPIPE means fvwm is dying
*
*/
static RETSIGTYPE
static void
TerminateHandler(int nonsense)
{
isTerminated = True;

SIGNAL_RETURN;
return;
}

/*
Expand All @@ -693,9 +693,9 @@ TerminateHandler(int nonsense)
* Externally callable procedure to quit
*
*/
RETSIGTYPE DeadPipe(int flag)
void DeadPipe(int flag)
{
execute_event(builtin_event_table, BUILTIN_SHUTDOWN, NULL);
exit(flag);
SIGNAL_RETURN;
return;
}
10 changes: 5 additions & 5 deletions modules/FvwmForm/FvwmForm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2559,11 +2559,11 @@ static void MainLoop(void)


/* signal-handler to make the application quit */
static RETSIGTYPE
static void
TerminateHandler(int sig)
{
fvwmSetTerminate(sig);
SIGNAL_RETURN;
return;
}

/* signal-handler to make the timer work */
Expand Down Expand Up @@ -2624,7 +2624,7 @@ TimerHandler(evutil_socket_t fd, short ev, void *arg)
RedrawTimeout(timer);
}

SIGNAL_RETURN;
return;
}


Expand Down Expand Up @@ -2745,10 +2745,10 @@ int main (int argc, char **argv)
}


RETSIGTYPE DeadPipe(int nonsense)
void DeadPipe(int nonsense)
{
exit(0);
SIGNAL_RETURN;
return;
}

/*
Expand Down
2 changes: 1 addition & 1 deletion modules/FvwmForm/FvwmForm.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,6 @@ int FontWidth (XFontStruct *xfs); /* FvwmForm.c */
void RedrawFrame (XEvent *pev); /* FvwmForm.c */
char * ParseCommand (int, char *, char, int *, char **s); /* ParseCommand.c */

RETSIGTYPE DeadPipe(int nonsense); /* FvwmForm.c */
void DeadPipe(int nonsense); /* FvwmForm.c */

#endif
Loading

0 comments on commit 0fab71f

Please sign in to comment.