Clean up some preprocessor operations

This commit is contained in:
Paul Smith 2023-01-16 13:01:09 -05:00
parent 9b9f3351d1
commit 8285852e55
7 changed files with 30 additions and 32 deletions

View File

@ -292,8 +292,8 @@ ar_scan (const char *archive, ar_member_func_t function, const void *varg)
#else /* !MK_OS_VMS */ #else /* !MK_OS_VMS */
/* SCO Unix's compiler defines both of these. */ /* SCO Unix's compiler defines both of these. */
#ifdef M_UNIX #ifdef M_UNIX
#undef M_XENIX #undef M_XENIX
#endif #endif
/* On the sun386i and in System V rel 3, ar.h defines two different archive /* On the sun386i and in System V rel 3, ar.h defines two different archive
@ -302,7 +302,7 @@ ar_scan (const char *archive, ar_member_func_t function, const void *varg)
to have a nonzero value. */ to have a nonzero value. */
#if (!defined (PORTAR) || PORTAR == 0) && (!defined (PORT5AR) || PORT5AR == 0) #if (!defined (PORTAR) || PORTAR == 0) && (!defined (PORT5AR) || PORT5AR == 0)
#undef PORTAR #undef PORTAR
#ifdef M_XENIX #ifdef M_XENIX
/* According to Jim Sievert <jas1@rsvl.unisys.com>, for SCO XENIX defining /* According to Jim Sievert <jas1@rsvl.unisys.com>, for SCO XENIX defining
PORTAR to 1 gets the wrong archive format, and defining it to 0 gets the PORTAR to 1 gets the wrong archive format, and defining it to 0 gets the

View File

@ -313,7 +313,7 @@ set_file_variables (struct file *file, const char *stem)
DEFINE_VARIABLE ("|", 1, bar_value); DEFINE_VARIABLE ("|", 1, bar_value);
} }
#undef DEFINE_VARIABLE #undef DEFINE_VARIABLE
} }
/* Chop CMDS up into individual command lines if necessary. /* Chop CMDS up into individual command lines if necessary.

View File

@ -552,17 +552,17 @@ static const char *default_variables[] =
"COFLAGS", "", "COFLAGS", "",
"CPP", "$(CC) -E", "CPP", "$(CC) -E",
#ifdef CRAY #ifdef CRAY
"CF77PPFLAGS", "-P", "CF77PPFLAGS", "-P",
"CF77PP", "/lib/cpp", "CF77PP", "/lib/cpp",
"CFT", "cft77", "CFT", "cft77",
"CF", "cf77", "CF", "cf77",
"FC", "$(CF)", "FC", "$(CF)",
#else /* Not CRAY. */ #else /* Not CRAY. */
#ifdef _IBMR2 #ifdef _IBMR2
"FC", "xlf", "FC", "xlf",
#else #else
#ifdef __convex__ #ifdef __convex__
"FC", "fc", "FC", "fc",
#else #else
"FC", "f77", "FC", "f77",
@ -582,10 +582,10 @@ static const char *default_variables[] =
#endif #endif
"LINT", "lint", "LINT", "lint",
"M2C", "m2c", "M2C", "m2c",
#ifdef pyr #ifdef pyr
"PC", "pascal", "PC", "pascal",
#else #else
#ifdef CRAY #ifdef CRAY
"PC", "PASCAL", "PC", "PASCAL",
"SEGLDR", "segldr", "SEGLDR", "segldr",
#else #else
@ -656,7 +656,7 @@ static const char *default_variables[] =
"OUTPUT_OPTION", "-o $@", "OUTPUT_OPTION", "-o $@",
#endif #endif
#ifdef SCCS_GET_MINUS_G #ifdef SCCS_GET_MINUS_G
"SCCS_OUTPUT_OPTION", "-G$@", "SCCS_OUTPUT_OPTION", "-G$@",
#endif #endif

View File

@ -20,7 +20,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#include "dep.h" #include "dep.h"
#include "debug.h" #include "debug.h"
#ifdef HAVE_DIRENT_H #ifdef HAVE_DIRENT_H
# include <dirent.h> # include <dirent.h>
# define NAMLEN(dirent) strlen((dirent)->d_name) # define NAMLEN(dirent) strlen((dirent)->d_name)
# if MK_OS_VMS # if MK_OS_VMS

View File

@ -1241,11 +1241,11 @@ main (int argc, char **argv, char **envp)
(void)bindtextdomain (PACKAGE, LOCALEDIR); (void)bindtextdomain (PACKAGE, LOCALEDIR);
(void)textdomain (PACKAGE); (void)textdomain (PACKAGE);
#ifdef POSIX #ifdef POSIX
sigemptyset (&fatal_signal_set); sigemptyset (&fatal_signal_set);
#define ADD_SIG(sig) sigaddset (&fatal_signal_set, sig) #define ADD_SIG(sig) sigaddset (&fatal_signal_set, sig)
#else #else
#ifdef HAVE_SIGSETMASK #ifdef HAVE_SIGSETMASK
fatal_signal_mask = 0; fatal_signal_mask = 0;
#define ADD_SIG(sig) fatal_signal_mask |= sigmask (sig) #define ADD_SIG(sig) fatal_signal_mask |= sigmask (sig)
#else #else
@ -1278,7 +1278,7 @@ main (int argc, char **argv, char **envp)
FATAL_SIG (SIGFPE); FATAL_SIG (SIGFPE);
#endif #endif
#ifdef SIGDANGER #ifdef SIGDANGER
FATAL_SIG (SIGDANGER); FATAL_SIG (SIGDANGER);
#endif #endif
#ifdef SIGXCPU #ifdef SIGXCPU
@ -1288,7 +1288,7 @@ main (int argc, char **argv, char **envp)
FATAL_SIG (SIGXFSZ); FATAL_SIG (SIGXFSZ);
#endif #endif
#undef FATAL_SIG #undef FATAL_SIG
/* Do not ignore the child-death signal. This must be done before /* Do not ignore the child-death signal. This must be done before
any children could possibly be created; otherwise, the wait any children could possibly be created; otherwise, the wait
@ -1405,7 +1405,7 @@ main (int argc, char **argv, char **envp)
if (getcwd (current_directory, GET_PATH_MAX) == 0) if (getcwd (current_directory, GET_PATH_MAX) == 0)
#endif #endif
{ {
#ifdef HAVE_GETCWD #ifdef HAVE_GETCWD
perror_with_name ("getcwd", ""); perror_with_name ("getcwd", "");
#else #else
OS (error, NILF, "getwd: %s", current_directory); OS (error, NILF, "getwd: %s", current_directory);
@ -1693,8 +1693,7 @@ main (int argc, char **argv, char **envp)
if (strpbrk (argv[0], "/:\\") || strstr (argv[0], "..") if (strpbrk (argv[0], "/:\\") || strstr (argv[0], "..")
|| strneq (argv[0], "//", 2)) || strneq (argv[0], "//", 2))
argv[0] = xstrdup (w32ify (argv[0], 1)); argv[0] = xstrdup (w32ify (argv[0], 1));
#else /* MK_OS_W32 */ #elif MK_OS_DOS || MK_OS_OS2
#if MK_OS_DOS || MK_OS_OS2
if (strchr (argv[0], '\\')) if (strchr (argv[0], '\\'))
{ {
char *p; char *p;
@ -1727,7 +1726,6 @@ main (int argc, char **argv, char **envp)
argv[0] = xstrdup (concat (3, current_directory, "/", argv[0])); argv[0] = xstrdup (concat (3, current_directory, "/", argv[0]));
#endif /* !MK_OS_DOS */ #endif /* !MK_OS_DOS */
#endif /* MK_OS_W32 */ #endif /* MK_OS_W32 */
#endif
/* We may move, but until we do, here we are. */ /* We may move, but until we do, here we are. */
starting_directory = current_directory; starting_directory = current_directory;
@ -1776,7 +1774,7 @@ main (int argc, char **argv, char **envp)
if (getcwd (current_directory, GET_PATH_MAX) == 0) if (getcwd (current_directory, GET_PATH_MAX) == 0)
#endif #endif
{ {
#ifdef HAVE_GETCWD #ifdef HAVE_GETCWD
perror_with_name ("getcwd", ""); perror_with_name ("getcwd", "");
#else #else
OS (error, NILF, "getwd: %s", current_directory); OS (error, NILF, "getwd: %s", current_directory);
@ -3531,7 +3529,7 @@ define_makeflags (int makefile)
abort (); abort ();
} }
#undef ADD_FLAG #undef ADD_FLAG
/* Four more for the possible " -- ", plus variable references. */ /* Four more for the possible " -- ", plus variable references. */
flagslen += 4 + CSTRLEN (posixref) + 4 + CSTRLEN (evalref) + 4; flagslen += 4 + CSTRLEN (posixref) + 4 + CSTRLEN (evalref) + 4;

View File

@ -49,7 +49,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
#endif #endif
#include "gnumake.h" #include "gnumake.h"
#ifdef CRAY #ifdef CRAY
/* This must happen before #include <signal.h> so /* This must happen before #include <signal.h> so
that the declaration therein is changed. */ that the declaration therein is changed. */
# define signal bsdsignal # define signal bsdsignal
@ -107,7 +107,7 @@ extern int errno;
# endif # endif
#endif #endif
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
/* Ultrix's unistd.h always defines _POSIX_VERSION, but you only get /* Ultrix's unistd.h always defines _POSIX_VERSION, but you only get
POSIX.1 behavior with 'cc -YPOSIX', which predefines POSIX itself! */ POSIX.1 behavior with 'cc -YPOSIX', which predefines POSIX itself! */
@ -137,10 +137,10 @@ extern int errno;
# include <vfork.h> # include <vfork.h>
#endif #endif
#ifdef HAVE_LIMITS_H #ifdef HAVE_LIMITS_H
# include <limits.h> # include <limits.h>
#endif #endif
#ifdef HAVE_SYS_PARAM_H #ifdef HAVE_SYS_PARAM_H
# include <sys/param.h> # include <sys/param.h>
#endif #endif
@ -154,7 +154,7 @@ extern int errno;
# endif # endif
#endif #endif
#ifdef PATH_MAX #ifdef PATH_MAX
# define GET_PATH_MAX PATH_MAX # define GET_PATH_MAX PATH_MAX
# define PATH_VAR(var) char var[PATH_MAX+1] # define PATH_VAR(var) char var[PATH_MAX+1]
#else #else
@ -269,16 +269,16 @@ void exit (int) NORETURN;
# define EXIT_FAILURE 1 # define EXIT_FAILURE 1
#endif #endif
#ifndef ANSI_STRING #ifndef ANSI_STRING
/* SCO Xenix has a buggy macro definition in <string.h>. */ /* SCO Xenix has a buggy macro definition in <string.h>. */
#undef strerror #undef strerror
#if !defined(__DECC) #if !defined(__DECC)
char *strerror (int errnum); char *strerror (int errnum);
#endif #endif
#endif /* !ANSI_STRING. */ #endif /* !ANSI_STRING. */
#undef ANSI_STRING #undef ANSI_STRING
#if HAVE_INTTYPES_H #if HAVE_INTTYPES_H
# include <inttypes.h> # include <inttypes.h>
@ -691,7 +691,7 @@ void dbg (const char *fmt, ...);
long int lseek (); long int lseek ();
# endif # endif
# ifdef HAVE_GETCWD # ifdef HAVE_GETCWD
# if !MK_OS_VMS && !defined(__DECC) # if !MK_OS_VMS && !defined(__DECC)
char *getcwd (void); char *getcwd (void);
# endif # endif

View File

@ -14,7 +14,7 @@ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program. If not, see <https://www.gnu.org/licenses/>. */ this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _PROC_H #ifndef _PROC_H
#define _PROC_H #define _PROC_H
typedef int bool_t; typedef int bool_t;