diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-12-11 10:02:13 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-01-03 11:02:11 -0800 |
commit | 3e486c4578f3f6a81fc0f9afba6551dfa8c7b63b (patch) | |
tree | 9530291dc25bd3f137778129297a32e76ceb8bb8 | |
parent | a3bbf780252e55bb1dcab717289ef09e00d11223 (diff) |
Only build debug infrastructure if DEBUG is defined
It's only used when DEBUG is defined, so don't build it when
we're not using it.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | listing.c | 2 | ||||
-rw-r--r-- | misc.c | 2 | ||||
-rw-r--r-- | utils.c | 4 | ||||
-rw-r--r-- | utils.h | 13 | ||||
-rw-r--r-- | xkbcomp.c | 4 | ||||
-rw-r--r-- | xkbparse.y | 5 | ||||
-rw-r--r-- | xkbscan.c | 2 |
7 files changed, 21 insertions, 11 deletions
@@ -123,7 +123,9 @@ SOFTWARE. #define lowbit(x) ((x) & (-(x))) +#ifdef DEBUG unsigned int listingDebug; +#endif static int szListing = 0; static int nListed = 0; @@ -73,8 +73,10 @@ ProcessIncludeFile(IncludeStmt * stmt, strcpy(oldFile, scanFile); oldLine = lineNum; setScanState(stmt->file, 1); +#ifdef DEBUG if (debugFlags & 2) INFO("About to parse include file %s\n", stmt->file); +#endif /* parse the file */ if ((XKBParseFile(file, &rtrn) == 0) || (rtrn == NULL)) { @@ -55,9 +55,10 @@ uRecalloc(void *old, size_t nOld, size_t nNew, size_t itemSize) /***====================================================================***/ -/*** PRINT FUNCTIONS ***/ +/*** DEBUG FUNCTIONS ***/ /***====================================================================***/ +#ifdef DEBUG static FILE *uDebugFile = NULL; int uDebugIndentLevel = 0; static const int uDebugIndentSize = 4; @@ -96,6 +97,7 @@ uDebug(char *s, ...) va_end(args); fflush(uDebugFile); } +#endif /***====================================================================***/ @@ -164,23 +164,22 @@ uInformation(const char * /* s */ , ... /***====================================================================***/ +#ifdef DEBUG #ifndef DEBUG_VAR #define DEBUG_VAR debugFlags #endif -extern - unsigned int DEBUG_VAR; +extern unsigned int DEBUG_VAR; - extern void uDebug(char * /* s */ , ... - ) _X_ATTRIBUTE_PRINTF(1, 2); +extern void uDebug(char *, ...) _X_ATTRIBUTE_PRINTF(1, 2); - extern Boolean uSetDebugFile(char *name); +extern Boolean uSetDebugFile(char *name); - extern int uDebugIndentLevel; +extern int uDebugIndentLevel; #define uDebugIndent(l) (uDebugIndentLevel+=(l)) #define uDebugOutdent(l) (uDebugIndentLevel-=(l)) -#ifdef DEBUG + #define uDEBUG(f,s) { if (DEBUG_VAR&(f)) uDebug(s);} #define uDEBUG1(f,s,a) { if (DEBUG_VAR&(f)) uDebug(s,a);} #define uDEBUG2(f,s,a,b) { if (DEBUG_VAR&(f)) uDebug(s,a,b);} @@ -67,7 +67,9 @@ #define INPUT_XKB 1 #define INPUT_XKM 2 +#ifdef DEBUG unsigned int debugFlags; +#endif static const char *fileTypeExt[] = { "XXX", @@ -905,7 +907,9 @@ main(int argc, char *argv[]) Status status; scan_set_file(stdin); +#ifdef DEBUG uSetDebugFile(NullString); +#endif uSetErrorFile(NullString); XkbInitIncludePath(); @@ -91,15 +91,14 @@ %{ #ifdef DEBUG #define YYDEBUG 1 -#endif #define DEBUG_VAR parseDebug +unsigned int parseDebug; +#endif #include "parseutils.h" #include <X11/keysym.h> #include <X11/extensions/XKBgeom.h> #include <stdlib.h> -unsigned int parseDebug; - %} %right EQUALS %left PLUS MINUS @@ -36,7 +36,9 @@ #include "utils.h" #include "parseutils.h" +#ifdef DEBUG unsigned int scanDebug; +#endif static FILE *yyin; |