From f099da35386cf63d4935ba2613409ff28b3d7ea5 Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Wed, 21 Jan 2009 20:43:28 -0200 Subject: Correct make distcheck and most gcc and sparse warnings. Remaining warnings are due to macros that check address or vectors on the stack and auto generated yacc code. Compiled with default flags and also as: % make CFLAGS=-DENTRY_TRACKING_ON -DDEBUG_ON -DASSERTIONS_ON to ensure the "simplification" of code like: foo.c: define DEBUG_VAR foo_VAR include "foo.h" ... foo.h: ifdef DEBUG_VAR_NOT_LOCAL extern endif int DEBUG_VAR; ... did not change the author's "intended" logic. --- .gitignore | 3 +++ Makefile.am | 2 +- compat.c | 1 + configure.ac | 8 ++++++++ expr.c | 4 ++-- indicators.c | 6 +++--- keycodes.c | 2 +- keymap.c | 2 +- keytypes.c | 4 ++-- listing.c | 3 ++- misc.c | 2 +- parseutils.c | 1 - tokens.h | 5 +++++ utils.h | 4 +--- vmod.c | 1 - xkbcomp.c | 9 +++++---- xkbcomp.h | 1 - xkbparse.y | 1 + xkbpath.c | 1 - xkbscan.c | 13 +++++-------- 20 files changed, 42 insertions(+), 31 deletions(-) diff --git a/.gitignore b/.gitignore index 9321cd0..e685f5a 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ xkbparse.h *~ *.o ylwrap +xkbcomp-*.tar.* +ChangeLog +tags diff --git a/Makefile.am b/Makefile.am index ffcbcbd..e5234d1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -105,6 +105,6 @@ MAINTAINERCLEANFILES += ChangeLog .PHONY: ChangeLog ChangeLog: - (GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2) + $(CHANGELOG_CMD) dist-hook: ChangeLog diff --git a/compat.c b/compat.c index f2f3f90..03c29ef 100644 --- a/compat.c +++ b/compat.c @@ -32,6 +32,7 @@ #include "misc.h" #include "indicators.h" #include "action.h" +#include "compat.h" typedef struct _SymInterpInfo { diff --git a/configure.ac b/configure.ac index c11850b..0470334 100644 --- a/configure.ac +++ b/configure.ac @@ -25,20 +25,28 @@ AC_INIT(xkbcomp,[1.0.5], [https://bugs.freedesktop.org/enter_bug.cgi?product=xor AM_INIT_AUTOMAKE([dist-bzip2]) AM_MAINTAINER_MODE +# Require xorg-macros: XORG_CWARNFLAGS, XORG_CHANGELOG +m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.2 or later before running autoconf/autogen])]) +XORG_MACROS_VERSION(1.2) + AM_CONFIG_HEADER(config.h) AC_PROG_CC AC_PROG_YACC AC_PROG_INSTALL +XORG_CWARNFLAGS + AC_CHECK_FUNCS([strdup strcasecmp]) # Checks for pkg-config packages PKG_CHECK_MODULES(XKBCOMP, x11 xkbfile) +XKBCOMP_CFLAGS="$CWARNFLAGS $XKBCOMP_CFLAGS" AC_SUBST(XKBCOMP_CFLAGS) AC_SUBST(XKBCOMP_LIBS) XORG_MANPAGE_SECTIONS XORG_RELEASE_VERSION +XORG_CHANGELOG AC_OUTPUT([Makefile]) diff --git a/expr.c b/expr.c index e116688..96fd956 100644 --- a/expr.c +++ b/expr.c @@ -488,7 +488,7 @@ ExprResolveFloat(ExprDef * expr, { register char *str; str = XkbAtomGetString(NULL, expr->value.str); - if ((str != None) && (strlen(str) == 1)) + if ((str != NULL) && (strlen(str) == 1)) { val_rtrn->uval = str[0] * XkbGeomPtsPerMM; return True; @@ -601,7 +601,7 @@ ExprResolveInteger(ExprDef * expr, { register char *str; str = XkbAtomGetString(NULL, expr->value.str); - if (str != None) + if (str != NULL) switch (strlen(str)) { case 0: diff --git a/indicators.c b/indicators.c index 080ae8e..d4a362f 100644 --- a/indicators.c +++ b/indicators.c @@ -152,7 +152,7 @@ AddIndicatorMap(LEDInfo * oldLEDs, LEDInfo * new) WSGO("Couldn't allocate indicator map\n"); ACTION1("Map for indicator %s not compiled\n", XkbAtomText(NULL, new->name, XkbMessage)); - return False; + return NULL; } *old = *new; old->defs.next = NULL; @@ -164,7 +164,7 @@ AddIndicatorMap(LEDInfo * oldLEDs, LEDInfo * new) return old; } -LookupEntry modComponentNames[] = { +static LookupEntry modComponentNames[] = { {"base", XkbIM_UseBase} , {"latched", XkbIM_UseLatched} @@ -181,7 +181,7 @@ LookupEntry modComponentNames[] = { , {NULL, 0} }; -LookupEntry groupComponentNames[] = { +static LookupEntry groupComponentNames[] = { {"base", XkbIM_UseBase} , {"latched", XkbIM_UseLatched} diff --git a/keycodes.c b/keycodes.c index a2f4396..1bff7fa 100644 --- a/keycodes.c +++ b/keycodes.c @@ -500,7 +500,7 @@ HandleIncludeKeycodes(IncludeStmt * stmt, XkbDescPtr xkb, KeyNamesInfo * info) { unsigned newMerge; XkbFile *rtrn; - KeyNamesInfo included = {0}; + KeyNamesInfo included = {NULL}; Bool haveSelf; haveSelf = False; diff --git a/keymap.c b/keymap.c index 4736eb8..a419d8c 100644 --- a/keymap.c +++ b/keymap.c @@ -39,7 +39,7 @@ #define SYMBOLS 4 #define MAX_SECTIONS 5 -XkbFile *sections[MAX_SECTIONS]; +static XkbFile *sections[MAX_SECTIONS]; /** * Compile the given file and store the output in result. diff --git a/keytypes.c b/keytypes.c index 3065d29..da55d75 100644 --- a/keytypes.c +++ b/keytypes.c @@ -1001,7 +1001,7 @@ HandleKeyTypeDef(KeyTypeDef * def, type.defs.defined = 0; type.defs.fileID = info->fileID; type.defs.merge = merge; - type.defs.next = 0; + type.defs.next = NULL; type.dpy = info->dpy; type.name = def->name; type.mask = info->dflt.mask; @@ -1221,7 +1221,7 @@ CompileKeyTypes(XkbFile * file, XkbFileInfo * result, unsigned merge) register KeyTypeInfo *def; register XkbKeyTypePtr type, next; - if (info.name != None) + if (info.name != NULL) { if (XkbAllocNames(xkb, XkbTypesNameMask, 0, 0) == Success) xkb->names->types = XkbInternAtom(xkb->dpy, info.name, False); diff --git a/listing.c b/listing.c index 996fdf2..146ecba 100644 --- a/listing.c +++ b/listing.c @@ -80,7 +80,6 @@ SOFTWARE. #include #endif -#define DEBUG_VAR_NOT_LOCAL #define DEBUG_VAR listingDebug #include "xkbcomp.h" #include @@ -126,6 +125,8 @@ SOFTWARE. #define lowbit(x) ((x) & (-(x))) +unsigned int listingDebug; + static int szListing = 0; static int nListed = 0; static int nFilesListed = 0; diff --git a/misc.c b/misc.c index c7b41dd..0e4f61d 100644 --- a/misc.c +++ b/misc.c @@ -267,7 +267,7 @@ typedef struct _KeyNameDesc Bool used; } KeyNameDesc; -KeyNameDesc dfltKeys[] = { +static KeyNameDesc dfltKeys[] = { {XK_Escape, NoSymbol, "ESC\0"}, {XK_quoteleft, XK_asciitilde, "TLDE"}, {XK_1, XK_exclam, "AE01"}, diff --git a/parseutils.c b/parseutils.c index 6adcdfd..ad1b0d1 100644 --- a/parseutils.c +++ b/parseutils.c @@ -24,7 +24,6 @@ ********************************************************/ -#define DEBUG_VAR_NOT_LOCAL #define DEBUG_VAR parseDebug #include "parseutils.h" #include "xkbpath.h" diff --git a/tokens.h b/tokens.h index 026032e..970f3d4 100644 --- a/tokens.h +++ b/tokens.h @@ -96,4 +96,9 @@ #define FUNCTION_KEYS 76 #define ALTERNATE_GROUP 77 +extern Atom tok_ONE_LEVEL; +extern Atom tok_TWO_LEVEL; +extern Atom tok_ALPHABETIC; +extern Atom tok_KEYPAD; + #endif diff --git a/utils.h b/utils.h index e773dea..65e37c8 100644 --- a/utils.h +++ b/utils.h @@ -258,9 +258,7 @@ uInformation(const char * /* s */ , ... #define DEBUG_VAR debugFlags #endif -#ifdef DEBUG_VAR_NOT_LOCAL - extern -#endif +extern unsigned int DEBUG_VAR; extern void uDebug(char * /* s */ , ... diff --git a/vmod.c b/vmod.c index 4ade0a8..5578fd0 100644 --- a/vmod.c +++ b/vmod.c @@ -24,7 +24,6 @@ ********************************************************/ -#define DEBUG_VAR_NOT_LOCAL #define DEBUG_VAR debugFlags #include #include "xkbcomp.h" diff --git a/xkbcomp.c b/xkbcomp.c index ae5145d..988b5c5 100644 --- a/xkbcomp.c +++ b/xkbcomp.c @@ -38,7 +38,6 @@ #include #endif -#define DEBUG_VAR_NOT_LOCAL #define DEBUG_VAR debugFlags #include "xkbcomp.h" #include @@ -74,6 +73,8 @@ #define INPUT_XKB 1 #define INPUT_XKM 2 +unsigned int debugFlags; + static const char *fileTypeExt[] = { "XXX", "xkm", @@ -633,10 +634,10 @@ parseArgs(int argc, char *argv[]) inputFormat = INPUT_XKB; } #ifndef WIN32 - else if (strchr(inputFile, ':') == 0) + else if (strchr(inputFile, ':') == NULL) { #else - else if ((strchr(inputFile, ':') == 0) || (strlen(inputFile) > 2 && + else if ((strchr(inputFile, ':') == NULL) || (strlen(inputFile) > 2 && isalpha(inputFile[0]) && inputFile[1] == ':' && strchr(inputFile + 2, @@ -648,7 +649,7 @@ parseArgs(int argc, char *argv[]) if (inputFile[len - 1] == ')') { char *tmp; - if ((tmp = strchr(inputFile, '(')) != 0) + if ((tmp = strchr(inputFile, '(')) != NULL) { *tmp = '\0'; inputFile[len - 1] = '\0'; diff --git a/xkbcomp.h b/xkbcomp.h index cbd19b5..6e02ed5 100644 --- a/xkbcomp.h +++ b/xkbcomp.h @@ -28,7 +28,6 @@ #define XKBCOMP_H 1 #ifndef DEBUG_VAR -#define DEBUG_VAR_NOT_LOCAL #define DEBUG_VAR debugFlags #endif diff --git a/xkbparse.y b/xkbparse.y index 7a73e89..bee7bc6 100644 --- a/xkbparse.y +++ b/xkbparse.y @@ -98,6 +98,7 @@ #include #include +static unsigned int parseDebug; %} %right EQUALS diff --git a/xkbpath.c b/xkbpath.c index 10a6136..6802012 100644 --- a/xkbpath.c +++ b/xkbpath.c @@ -27,7 +27,6 @@ #include #include -#define DEBUG_VAR_NOT_LOCAL #define DEBUG_VAR debugFlags #include "utils.h" #include diff --git a/xkbscan.c b/xkbscan.c index bc7e230..31cafd4 100644 --- a/xkbscan.c +++ b/xkbscan.c @@ -35,6 +35,8 @@ #include "utils.h" #include "parseutils.h" +unsigned int scanDebug; + FILE *yyin = NULL; static char scanFileBuf[1024] = {0}; @@ -42,20 +44,15 @@ char *scanFile = scanFileBuf; int lineNum = 0; int scanInt; -char *scanIntStr; -int scanIntClass; char *scanStr = NULL; -int scanStrLine = 0; +static int scanStrLine = 0; #define BUFSIZE 512 static int nInBuf = 0; static char buf[BUFSIZE]; #ifdef DEBUG - -extern unsigned debugFlags; - static char * tokText(int tok) { @@ -446,7 +443,7 @@ yyGetKeyName(void) return ERROR_TOK; } -struct _Keyword +static struct _Keyword { const char *keyword; int token; @@ -543,7 +540,7 @@ struct _Keyword { "alternate_group", ALTERNATE_GROUP} }; -int numKeywords = sizeof(keywords) / sizeof(struct _Keyword); +static int numKeywords = sizeof(keywords) / sizeof(struct _Keyword); static int yyGetIdent(int first) -- cgit v1.2.3