From 298e9d909382349d7deb7a0396450c0d49b5e80a Mon Sep 17 00:00:00 2001 From: Erwin Janssen Date: Mon, 11 Jul 2016 21:14:18 +0200 Subject: [PATCH] Surrounded _PACKAGE_ast with defined() where needed. This solves more than a thousend Wundef warnings. --- cmd/lefty/dot2l/dotparse.y | 2 +- lib/agraph/agraph.h | 6 +++--- lib/cdt/cdt.h | 2 +- lib/cgraph/cgraph.h | 6 +++--- lib/graph/graph.h | 6 +++--- lib/graph/libgraph.h | 2 +- lib/neatogen/matinv.c | 2 +- lib/sfio/sfhdr.h | 18 +++++++++--------- lib/sfio/sfio.h | 4 ++-- lib/sfio/sfmode.c | 6 +++--- lib/sfio/sfpkrd.c | 2 +- lib/sfio/sfpopen.c | 8 ++++---- lib/sfio/sftmp.c | 16 ++++++++-------- lib/sfio/vthread.h | 2 +- lib/vmalloc/malloc.c | 2 +- lib/vmalloc/vmalloc.h | 2 +- lib/vmalloc/vmexit.c | 2 +- lib/vmalloc/vmhdr.h | 6 +++--- 18 files changed, 47 insertions(+), 47 deletions(-) diff --git a/cmd/lefty/dot2l/dotparse.y b/cmd/lefty/dot2l/dotparse.y index 212f2b81f..8e2dc3bc5 100644 --- a/cmd/lefty/dot2l/dotparse.y +++ b/cmd/lefty/dot2l/dotparse.y @@ -12,7 +12,7 @@ *************************************************************************/ %{ -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) #include #endif #include diff --git a/lib/agraph/agraph.h b/lib/agraph/agraph.h index b13234fa6..fc458c04a 100644 --- a/lib/agraph/agraph.h +++ b/lib/agraph/agraph.h @@ -230,7 +230,7 @@ for the name. */ }; -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) /* fine control of object callbacks */ # if defined(_BLD_agraph) && defined(__EXPORT__) # define extern __EXPORT__ @@ -395,7 +395,7 @@ for the name. */ #define aghead(e) AGHEAD(e) #define agopp(e) AGOPP(e) -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) # if !defined(_BLD_agraph) && defined(__IMPORT__) # define extern __IMPORT__ # endif @@ -408,7 +408,7 @@ for the name. */ Agstrictundirected; #undef extern -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) _END_EXTERNS_ #endif #ifdef __cplusplus diff --git a/lib/cdt/cdt.h b/lib/cdt/cdt.h index e19404e12..323f983e4 100644 --- a/lib/cdt/cdt.h +++ b/lib/cdt/cdt.h @@ -240,7 +240,7 @@ extern int dtstat _ARG_((Dt_t*, Dtstat_t*, int)); extern unsigned int dtstrhash _ARG_((unsigned int, Void_t*, int)); #if 0 -#if !_PACKAGE_ast +#if !defined(_PACKAGE_ast) extern int memcmp _ARG_((const Void_t*, const Void_t*, size_t)); extern int strcmp _ARG_((const char*, const char*)); #endif diff --git a/lib/cgraph/cgraph.h b/lib/cgraph/cgraph.h index 1e9f9241e..61a3650cc 100644 --- a/lib/cgraph/cgraph.h +++ b/lib/cgraph/cgraph.h @@ -255,7 +255,7 @@ struct Agraph_s { }; -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) /* fine control of object callbacks */ # if defined(_BLD_cgraph) && defined(__EXPORT__) # define extern __EXPORT__ @@ -427,7 +427,7 @@ extern agusererrf agseterrf(agusererrf); #define TAILPORT_ID "tailport" #define HEADPORT_ID "headport" -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) # if !defined(_BLD_cgraph) && defined(__IMPORT__) # define extern __IMPORT__ # endif @@ -470,7 +470,7 @@ and edges are embedded in main graph objects but allocated separately in subgrap #define EDGEOF(sn,rep) (AGSNMAIN(sn)?((Agedge_t*)((unsigned char*)(rep) - offsetof(Agedge_t,seq_link))) : ((Dthold_t*)(rep))->obj) #undef extern -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) _END_EXTERNS_ #endif #ifdef __cplusplus diff --git a/lib/graph/graph.h b/lib/graph/graph.h index 9b788fba2..029d088a0 100644 --- a/lib/graph/graph.h +++ b/lib/graph/graph.h @@ -16,7 +16,7 @@ #ifndef _GRAPH_H #define _GRAPH_H 1 -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) #include #else #include @@ -122,7 +122,7 @@ extern "C" { Agproto_t *prev; }; -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) _BEGIN_EXTERNS_ /* public data */ #if _BLD_graph && defined(__EXPORT__) #define extern __EXPORT__ @@ -229,7 +229,7 @@ extern "C" { #define agmetanode(g) ((g)->meta_node) #undef extern -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) _END_EXTERNS_ #endif #ifdef __cplusplus diff --git a/lib/graph/libgraph.h b/lib/graph/libgraph.h index 0b30b850b..3e54a63e1 100644 --- a/lib/graph/libgraph.h +++ b/lib/graph/libgraph.h @@ -19,7 +19,7 @@ extern "C" { #ifndef _LIBGRAPH_H #define _LIBGRAPH_H 1 -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) #include #else #include diff --git a/lib/neatogen/matinv.c b/lib/neatogen/matinv.c index 25f197f70..0f3bf1f01 100644 --- a/lib/neatogen/matinv.c +++ b/lib/neatogen/matinv.c @@ -34,7 +34,7 @@ * n - the order of the matrices A and Ainv */ -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) #include #else #endif diff --git a/lib/sfio/sfhdr.h b/lib/sfio/sfhdr.h index 80907db10..88552b0a8 100644 --- a/lib/sfio/sfhdr.h +++ b/lib/sfio/sfhdr.h @@ -32,7 +32,7 @@ extern "C" { #include /* file system info */ -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) #include #include @@ -47,7 +47,7 @@ extern "C" { #define _lib_locale 1 #endif -#else /*!_PACKAGE_ast */ +#else /*!defined(_PACKAGE_ast) */ #if __mips == 2 && !defined(_NO_LARGEFILE64_SOURCE) #define _NO_LARGEFILE64_SOURCE 1 @@ -143,7 +143,7 @@ extern "C" { #include #endif -#endif /*_PACKAGE_ast*/ +#endif /*defined(_PACKAGE_ast)*/ #include #include @@ -459,7 +459,7 @@ extern "C" { #define ESPIPE 29 #endif /* see if we can use memory mapping for io */ -#if !_PACKAGE_ast && _mmap_worthy +#if !defined(_PACKAGE_ast) && _mmap_worthy # ifdef _LARGEFILE64_SOURCE # undef mmap # endif @@ -823,7 +823,7 @@ extern "C" { #define SF_RADIX 64 /* maximum integer conversion base */ -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) #define SF_MAXINT INT_MAX #define SF_MAXLONG LONG_MAX #else @@ -928,7 +928,7 @@ extern "C" { #define max(x,y) ((x) > (y) ? (x) : (y)) /* fast functions for memory copy and memory clear */ -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) #define memclear(s,n) memzero(s,n) #else #if _lib_bcopy && !_lib_memcpy @@ -939,7 +939,7 @@ extern "C" { #else #define memclear(s,n) memset((s),'\0',(n)) #endif -#endif /*_PACKAGE_ast*/ +#endif /*defined(_PACKAGE_ast)*/ /* note that MEMCPY advances the associated pointers */ #define MEMCPY(to,fr,n) \ @@ -1000,7 +1000,7 @@ extern "C" { extern int munmap _ARG_((Void_t *, size_t)); #endif -#if !_PACKAGE_ast +#if !defined(_PACKAGE_ast) #if /*!__STDC__ &&*/ !_hdr_stdlib extern void abort _ARG_((void)); @@ -1089,7 +1089,7 @@ extern "C" { extern int open _ARG_((const char *, int, ...)); #endif -#endif /* _PACKAGE_ast */ +#endif /* defined(_PACKAGE_ast) */ _END_EXTERNS_ #endif /*_SFHDR_H*/ diff --git a/lib/sfio/sfio.h b/lib/sfio/sfio.h index 2945f6ed6..52f05503d 100644 --- a/lib/sfio/sfio.h +++ b/lib/sfio/sfio.h @@ -25,7 +25,7 @@ extern "C" { ** Written by Kiem-Phong Vo */ -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) #include #else #include @@ -93,7 +93,7 @@ extern "C" { #endif #endif -#endif /* _PACKAGE_ast */ +#endif /* defined(_PACKAGE_ast) */ /* Sfoff_t should be large enough for largest file address */ diff --git a/lib/sfio/sfmode.c b/lib/sfio/sfmode.c index 99c7a1292..2a84e86c0 100644 --- a/lib/sfio/sfmode.c +++ b/lib/sfio/sfmode.c @@ -34,7 +34,7 @@ static char *Version = "\n@(#)sfio (AT&T Labs - kpv) 2001-02-01\0\n"; */ /* the below is for protecting the application from SIGPIPE */ -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) #include #include #define Sfsignal_f Sig_handler_t @@ -257,7 +257,7 @@ reg Sfio_t *f; /* stream to close */ CLOSE(p->file); /* wait for process termination */ -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) sigcritical(1); #endif #ifndef WIN32 @@ -266,7 +266,7 @@ reg Sfio_t *f; /* stream to close */ #endif if (pid < 0) status = -1; -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) sigcritical(0); #endif diff --git a/lib/sfio/sfpkrd.c b/lib/sfio/sfpkrd.c index cef096314..efd5bf608 100644 --- a/lib/sfio/sfpkrd.c +++ b/lib/sfio/sfpkrd.c @@ -12,7 +12,7 @@ *************************************************************************/ #include "sfhdr.h" -#if !_PACKAGE_ast +#if !defined(_PACKAGE_ast) #ifndef FIONREAD #if _sys_ioctl #include diff --git a/lib/sfio/sfpopen.c b/lib/sfio/sfpopen.c index 28fd4d721..4f504da0f 100644 --- a/lib/sfio/sfpopen.c +++ b/lib/sfio/sfpopen.c @@ -17,7 +17,7 @@ ** Written by Kiem-Phong Vo. */ -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) #include #else @@ -123,7 +123,7 @@ char *argcmd; _exit(EXIT_NOTFOUND); } -#endif /*_PACKAGE_ast*/ +#endif /*defined(_PACKAGE_ast)*/ #ifndef WIN32 #if __STD_C @@ -135,7 +135,7 @@ char *command; /* command to execute */ char *mode; /* mode of the stream */ #endif { -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) reg Proc_t *proc; reg int sflags; reg long flags; @@ -292,6 +292,6 @@ char *mode; /* mode of the stream */ } return NIL(Sfio_t *); } -#endif /*_PACKAGE_ast*/ +#endif /*defined(_PACKAGE_ast)*/ } #endif diff --git a/lib/sfio/sftmp.c b/lib/sfio/sftmp.c index 03ff62641..60696d4f5 100644 --- a/lib/sfio/sftmp.c +++ b/lib/sfio/sftmp.c @@ -140,7 +140,7 @@ char *file; return 0; } -#if !_PACKAGE_ast +#if !defined(_PACKAGE_ast) #include #define TMPDFLT "/tmp" static char **Tmppath, **Tmpcur; @@ -190,7 +190,7 @@ char *path; return dirs; } -#endif /*!_PACKAGE_ast */ +#endif /*!defined(_PACKAGE_ast) */ #if __STD_C static int _tmpfd(Sfio_t * f) @@ -203,7 +203,7 @@ Sfio_t *f; reg int fd; int t; -#if !_PACKAGE_ast +#if !defined(_PACKAGE_ast) /* set up path of dirs to create temp files */ if (!Tmppath && !(Tmppath = _sfgetpath("TMPPATH"))) { if (!(Tmppath = (char **) malloc(2 * sizeof(char *)))) @@ -224,12 +224,12 @@ Sfio_t *f; Tmpcur += 1; if (!Tmpcur || !Tmpcur[0]) Tmpcur = Tmppath; -#endif /*!_PACKAGE_ast */ +#endif /*!defined(_PACKAGE_ast) */ file = NIL(char *); fd = -1; for (t = 0; t < 10; ++t) { /* compute a random name */ -#if !_PACKAGE_ast +#if !defined(_PACKAGE_ast) static ulong Key, A; if (A == 0 || t > 0) { /* get a quasi-random coefficient */ reg int r; @@ -246,7 +246,7 @@ Sfio_t *f; Tmpcur[0], (Key >> 15) & 0x7fff, Key & 0x7fff); #else file = pathtmp(file, NiL, "sf", NiL); -#endif /*!_PACKAGE_ast */ +#endif /*!defined(_PACKAGE_ast) */ if (!file) return -1; @@ -273,9 +273,9 @@ Sfio_t *f; if (fd >= 0) _rmtmp(f, file); -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) free(file); -#endif /*_PACKAGE_ast*/ +#endif /*defined(_PACKAGE_ast)*/ return fd; } diff --git a/lib/sfio/vthread.h b/lib/sfio/vthread.h index 2590c888d..1709ac066 100644 --- a/lib/sfio/vthread.h +++ b/lib/sfio/vthread.h @@ -31,7 +31,7 @@ extern "C" { #include /* ast doesn't do threads yet */ -#if _PACKAGE_ast && !defined(vt_threaded) +#if defined(_PACKAGE_ast) && !defined(vt_threaded) #define vt_threaded 0 #endif diff --git a/lib/vmalloc/malloc.c b/lib/vmalloc/malloc.c index 86f335bf0..018e569df 100644 --- a/lib/vmalloc/malloc.c +++ b/lib/vmalloc/malloc.c @@ -159,7 +159,7 @@ char *file; } *next = '\0'; -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) return open(buf, O_WRONLY | O_CREAT | O_TRUNC, CREAT_MODE); #else return creat(buf, CREAT_MODE); diff --git a/lib/vmalloc/vmalloc.h b/lib/vmalloc/vmalloc.h index 2a2402739..d0fc27b42 100644 --- a/lib/vmalloc/vmalloc.h +++ b/lib/vmalloc/vmalloc.h @@ -25,7 +25,7 @@ extern "C" { #define VMALLOC_VERSION 19990805L -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) #include #else #include diff --git a/lib/vmalloc/vmexit.c b/lib/vmalloc/vmexit.c index 99621567d..0861dcfe2 100644 --- a/lib/vmalloc/vmexit.c +++ b/lib/vmalloc/vmexit.c @@ -17,7 +17,7 @@ ** Any required functions for process exiting. ** Written by Kiem-Phong Vo, kpv@research.att.com (05/25/93). */ -#if _PACKAGE_ast || _lib_atexit +#if defined(_PACKAGE_ast) || _lib_atexit int Vm_atexit_already_defined; #else diff --git a/lib/vmalloc/vmhdr.h b/lib/vmalloc/vmhdr.h index d27389a8c..b014b2eed 100644 --- a/lib/vmalloc/vmhdr.h +++ b/lib/vmalloc/vmhdr.h @@ -30,7 +30,7 @@ extern "C" { */ -#if _PACKAGE_ast +#if defined(_PACKAGE_ast) #if defined(__STDPP__directive) && defined(__STDPP__hide) __STDPP__directive pragma pp:hide getpagesize @@ -51,7 +51,7 @@ extern "C" { #include #include "FEATURE/vmalloc" -#endif /*_PACKAGE_ast*/ +#endif /*defined(_PACKAGE_ast)*/ #undef free #undef malloc @@ -435,7 +435,7 @@ extern "C" { _BEGIN_EXTERNS_ extern Vmextern_t _Vmextern; -#if !_PACKAGE_ast +#if !defined(_PACKAGE_ast) extern size_t getpagesize _ARG_((void)); -- 2.40.0