summaryrefslogtreecommitdiff
blob: c5cfad840c158545700ca429fe97bbf1727cd455 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
Fix -Werror=format-security errors
Also fix incorrect printf() format specifiers
https://bugs.gentoo.org/show_bug.cgi?id=520988

* gen.c: In function 'genHdr':
* gen.c:3869:17: error: format not a string literal and no format arguments [-Werror=format-security]

--- cdrdao-1.2.3/pccts/antlr/bits.c
+++ cdrdao-1.2.3/pccts/antlr/bits.c
@@ -574,13 +574,13 @@
 	else
 		fprintf(DefFile, "extern SetWordType zzerr%d[];\n", esetnum);
 	if ( name!=NULL ) {
-		fprintf(ErrFile, "SetWordType %s%s[%d] = {",
+		fprintf(ErrFile, "SetWordType %s%s[%lu] = {",
 				name,
                 suffix,
 				NumWords(TokenNum-1)*sizeof(unsigned));
 	}
 	else {
-		fprintf(ErrFile, "SetWordType zzerr%d[%d] = {",
+		fprintf(ErrFile, "SetWordType zzerr%d[%lu] = {",
 				esetnum,
 				NumWords(TokenNum-1)*sizeof(unsigned));
 	}
@@ -642,20 +642,20 @@
 	esetnum++;
 
 	if ( name!=NULL ) {
-		fprintf(Parser_h, "\tstatic SetWordType %s%s[%d];\n", name, suffix,
+		fprintf(Parser_h, "\tstatic SetWordType %s%s[%lu];\n", name, suffix,
 				NumWords(TokenNum-1)*sizeof(unsigned));
-		fprintf(Parser_c, "SetWordType %s::%s%s[%d] = {",
+		fprintf(Parser_c, "SetWordType %s::%s%s[%lu] = {",
 				CurrentClassName,
 				name,
 				suffix,
 				NumWords(TokenNum-1)*sizeof(unsigned));
 	}
 	else {
-		fprintf(Parser_c, "SetWordType %s::err%d[%d] = {",
+		fprintf(Parser_c, "SetWordType %s::err%d[%lu] = {",
 				CurrentClassName,
 				esetnum,
 				NumWords(TokenNum-1)*sizeof(unsigned));
-		fprintf(Parser_h, "\tstatic SetWordType err%d[%d];\n", esetnum,
+		fprintf(Parser_h, "\tstatic SetWordType err%d[%lu];\n", esetnum,
 				NumWords(TokenNum-1)*sizeof(unsigned));
 	}
 
@@ -788,7 +788,7 @@
 
 	/* Build constructors */
 	fprintf(Parser_c, "\n%s::", CurrentClassName);
-	fprintf(Parser_c,	"%s(ANTLRTokenBuffer *input) : %s(input,%d,%d,%d,%d)\n",
+	fprintf(Parser_c,	"%s(ANTLRTokenBuffer *input) : %s(input,%d,%d,%d,%lu)\n",
 						CurrentClassName,
 						(BaseClassName == NULL ? "ANTLRParser" : BaseClassName),
 						OutputLL_k,
@@ -913,7 +913,7 @@
 #ifdef DUM
 	if ( LexGen ) fprintf(ErrFile, "#define zzEOF_TOKEN %d\n", (TokenInd!=NULL?TokenInd[EofToken]:EofToken));
 #endif
-	fprintf(ErrFile, "#define zzSET_SIZE %d\n", NumWords(TokenNum-1)*sizeof(unsigned));
+	fprintf(ErrFile, "#define zzSET_SIZE %lu\n", NumWords(TokenNum-1)*sizeof(unsigned));
 	if ( DemandLookahead ) fprintf(ErrFile, "#define DEMAND_LOOK\n");
 	fprintf(ErrFile, "#include \"antlr.h\"\n");
 	if ( GenAST ) fprintf(ErrFile, "#include \"ast.h\"\n");
--- cdrdao-1.2.3/pccts/antlr/fset2.c
+++ cdrdao-1.2.3/pccts/antlr/fset2.c
@@ -2210,7 +2210,7 @@
       if (p->ntype != nToken) continue;
       tn=(TokNode *)p;
       if (depth != 0) fprintf(stdout," ");
-      fprintf(stdout,TerminalString(tn->token));
+      fprintf(stdout,"%s",TerminalString(tn->token));
       depth++;
       if (! MR_AmbAidMultiple) {
         if (set_nil(tn->tset)) {
--- cdrdao-1.2.3/pccts/antlr/gen.c
+++ cdrdao-1.2.3/pccts/antlr/gen.c
@@ -159,7 +159,7 @@
 #define gen6(s,a,b,c,d,e,f)	{tab(); fprintf(output, s,a,b,c,d,e,f);}
 #define gen7(s,a,b,c,d,e,f,g)	{tab(); fprintf(output, s,a,b,c,d,e,f,g);}
 
-#define _gen(s)			{fprintf(output, s);}
+#define _gen(s)			{fprintf(output, "%s", s);}
 #define _gen1(s,a)		{fprintf(output, s,a);}
 #define _gen2(s,a,b)	{fprintf(output, s,a,b);}
 #define _gen3(s,a,b,c)	{fprintf(output, s,a,b,c);}
@@ -3911,7 +3911,7 @@
 	}
 #endif
 	/* ###WARNING: This will have to change when SetWordSize changes */
-	if ( !GenCC ) _gen1("#define zzSET_SIZE %d\n", NumWords(TokenNum-1)*sizeof(unsigned));
+	if ( !GenCC ) _gen1("#define zzSET_SIZE %lu\n", NumWords(TokenNum-1)*sizeof(unsigned));
     if (TraceGen) {
       _gen("#ifndef zzTRACE_RULES\n");  /* MR20 */
       _gen("#define zzTRACE_RULES\n");  /* MR20 */
@@ -4125,7 +4125,7 @@
 	if ( LexGen ) fprintf(f, "#define zzEOF_TOKEN %d\n", (TokenInd!=NULL?TokenInd[EofToken]:EofToken));
 #endif
 	/* ###WARNING: This will have to change when SetWordSize changes */
-	fprintf(f, "#define zzSET_SIZE %d\n", NumWords(TokenNum-1)*sizeof(unsigned));
+	fprintf(f, "#define zzSET_SIZE %lu\n", NumWords(TokenNum-1)*sizeof(unsigned));
     if (TraceGen) {
       fprintf(f,"#ifndef zzTRACE_RULES\n");  /* MR20 */
       fprintf(f,"#define zzTRACE_RULES\n");  /* MR20 */
--- cdrdao-1.2.3/pccts/antlr/lex.c
+++ cdrdao-1.2.3/pccts/antlr/lex.c
@@ -706,7 +706,7 @@
 /* MR26 */			if (! (isalpha(*t) || isdigit(*t) || *t == '_' || *t == '$')) break;
 /* MR26 */		}
 /* MR26 */	}
-/* MR26 */	fprintf(output,strBetween(pSymbol, t, pSeparator));
+/* MR26 */	fprintf(output,"%s",strBetween(pSymbol, t, pSeparator));
 
     *q = p;
     return (*pSeparator  == 0);
@@ -771,7 +771,7 @@
 				  &pValue,
 				  &pSeparator,
 				  &nest);
-	fprintf(f,strBetween(pDataType, pSymbol, pSeparator));
+	fprintf(f,"%s",strBetween(pDataType, pSymbol, pSeparator));
 }
 
 /* check to see if string e is a word in string s */
@@ -852,9 +852,9 @@
 					  &pSeparator,
 					  &nest);
 		fprintf(f,"\t");
-		fprintf(f,strBetween(pDataType, pSymbol, pSeparator));
+		fprintf(f,"%s",strBetween(pDataType, pSymbol, pSeparator));
 		fprintf(f," ");
-		fprintf(f,strBetween(pSymbol, pEqualSign, pSeparator));
+		fprintf(f,"%s",strBetween(pSymbol, pEqualSign, pSeparator));
 		fprintf(f,";\n");
     }
 	fprintf(f,"};\n");
--- cdrdao-1.2.3/pccts/antlr/set.c
+++ cdrdao-1.2.3/pccts/antlr/set.c
@@ -263,7 +263,7 @@
 	static set a;
 
 	if ( b == nil ) return( empty );
-	set_new(a, b);
+	set_new(a, (long unsigned int) b);
 	a.setword[DIVWORD(b)] = bitmask[MODWORD(b)];
 
 	return(a);
--- cdrdao-1.2.3/pccts/dlg/set.c
+++ cdrdao-1.2.3/pccts/dlg/set.c
@@ -263,7 +263,7 @@
 	static set a;
 
 	if ( b == nil ) return( empty );
-	set_new(a, b);
+	set_new(a, (long unsigned int) b);
 	a.setword[DIVWORD(b)] = bitmask[MODWORD(b)];
 
 	return(a);
--- cdrdao-1.2.3/pccts/h/set.h
+++ cdrdao-1.2.3/pccts/h/set.h
@@ -55,7 +55,7 @@
 /* make arg1 a set big enough to hold max elem # of arg2 */
 #define set_new(a,_max) \
 if (((a).setword=(unsigned *)calloc(NumWords(_max),BytesPerWord))==NULL) \
-        fprintf(stderr, "set_new: Cannot allocate set with max of %d\n", _max); \
+        fprintf(stderr, "set_new: Cannot allocate set with max of %lu\n", _max); \
         (a).n = NumWords(_max);
 
 #define set_free(a)									\