summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-11 10:02:13 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-01-03 11:02:11 -0800
commit3e486c4578f3f6a81fc0f9afba6551dfa8c7b63b (patch)
tree9530291dc25bd3f137778129297a32e76ceb8bb8
parenta3bbf780252e55bb1dcab717289ef09e00d11223 (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.c2
-rw-r--r--misc.c2
-rw-r--r--utils.c4
-rw-r--r--utils.h13
-rw-r--r--xkbcomp.c4
-rw-r--r--xkbparse.y5
-rw-r--r--xkbscan.c2
7 files changed, 21 insertions, 11 deletions
diff --git a/listing.c b/listing.c
index 663c652..3db66f8 100644
--- a/listing.c
+++ b/listing.c
@@ -123,7 +123,9 @@ SOFTWARE.
#define lowbit(x) ((x) & (-(x)))
+#ifdef DEBUG
unsigned int listingDebug;
+#endif
static int szListing = 0;
static int nListed = 0;
diff --git a/misc.c b/misc.c
index b41a64c..24ad0ed 100644
--- a/misc.c
+++ b/misc.c
@@ -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))
{
diff --git a/utils.c b/utils.c
index 8b7b6c5..6dd7e78 100644
--- a/utils.c
+++ b/utils.c
@@ -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
/***====================================================================***/
diff --git a/utils.h b/utils.h
index 7a4d641..2ccff4f 100644
--- a/utils.h
+++ b/utils.h
@@ -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);}
diff --git a/xkbcomp.c b/xkbcomp.c
index 98e0d26..1be264d 100644
--- a/xkbcomp.c
+++ b/xkbcomp.c
@@ -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();
diff --git a/xkbparse.y b/xkbparse.y
index 88df242..5253e48 100644
--- a/xkbparse.y
+++ b/xkbparse.y
@@ -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
diff --git a/xkbscan.c b/xkbscan.c
index 9334f8a..fc2d0a7 100644
--- a/xkbscan.c
+++ b/xkbscan.c
@@ -36,7 +36,9 @@
#include "utils.h"
#include "parseutils.h"
+#ifdef DEBUG
unsigned int scanDebug;
+#endif
static FILE *yyin;