| 1 |
https://github.com/pkubowicz/opendetex/pull/86 |
| 2 |
|
| 3 |
From 069c8e4af14840c039ade63dcb8c0354b5e4306c Mon Sep 17 00:00:00 2001 |
| 4 |
From: mbuhl <[email protected]> |
| 5 |
Date: Mon, 27 May 2024 14:59:41 +0200 |
| 6 |
Subject: [PATCH] Fix compiler warnings. |
| 7 |
|
| 8 |
cc -O2 -pipe -DVERSION='"2.8.11"' -c -o detex.o detex.c |
| 9 |
detex.l:140:7: warning: a function declaration without a prototype is deprecated in all versions of C and is treated as a zero-parameter prototype in C2x, conflicting with a previous declaration [-Wdeprecated-non-prototype] |
| 10 |
char *getenv(); |
| 11 |
^ |
| 12 |
/usr/include/stdlib.h:110:7: note: conflicting prototype is here |
| 13 |
char *getenv(const char *); |
| 14 |
^ |
| 15 |
detex.l:413:36: warning: expression which evaluates to zero treated as a null pointer constant of type 'char *' [-Wnon-literal-null-conversion] |
| 16 |
rgsbIncList[csbIncList++] = '\0'; |
| 17 |
^~~~ |
| 18 |
detex.l:360:54: warning: result of comparison of constant -1 with expression of type 'char' is always true [-Wtautological-constant-out-of-range-compare] |
| 19 |
while ((c = input()) != verbchar && c != '\n' && c != EOF && c != 0) { |
| 20 |
~ ^ ~~~ |
| 21 |
detex.l:825:8: warning: a function declaration without a prototype is deprecated in all versions of C and is treated as a zero-parameter prototype in C2x, conflicting with a previous declaration [-Wdeprecated-non-prototype] |
| 22 |
FILE *TexOpen(); |
| 23 |
^ |
| 24 |
detex.l:137:7: note: conflicting prototype is here |
| 25 |
FILE *TexOpen(char *sbFile); |
| 26 |
^ |
| 27 |
detex.l:851:8: warning: a function declaration without a prototype is deprecated in all versions of C and is treated as a zero-parameter prototype in C2x, conflicting with a previous declaration [-Wdeprecated-non-prototype] |
| 28 |
FILE *TexOpen(); |
| 29 |
^ |
| 30 |
detex.l:137:7: note: conflicting prototype is here |
| 31 |
FILE *TexOpen(char *sbFile); |
| 32 |
^ |
| 33 |
5 warnings generated. |
| 34 |
--- |
| 35 |
detex.l | 10 +++------- |
| 36 |
1 file changed, 3 insertions(+), 7 deletions(-) |
| 37 |
|
| 38 |
diff --git a/detex.l b/detex.l |
| 39 |
index 591dc0a..2195822 100644 |
| 40 |
--- a/detex.l |
| 41 |
+++ b/detex.l |
| 42 |
@@ -137,7 +137,7 @@ int SeparateList(char *sbList, char *rgsbList[] ,char chSep, int csbMax); |
| 43 |
FILE *TexOpen(char *sbFile); |
| 44 |
char *SafeMalloc(int cch, const char *sbMessage); |
| 45 |
#ifndef KPATHSEA |
| 46 |
-char *getenv(); |
| 47 |
+char *getenv(const char *); |
| 48 |
#ifndef NO_MALLOC_DECL |
| 49 |
char *malloc(); |
| 50 |
#endif |
| 51 |
@@ -351,7 +351,7 @@ VERBSYMBOL =|\\leq|\\geq|\\in|>|<|\\subseteq|\subseteq|\\subset|\\supset|\\sim|\ |
| 52 |
} |
| 53 |
<Normal>"\\verb" /* ignore \verb<ch>...<ch> */ { |
| 54 |
if (fLatex) { |
| 55 |
- char verbchar, c; |
| 56 |
+ int verbchar, c; |
| 57 |
verbchar = input(); |
| 58 |
if (verbchar < ' ') { |
| 59 |
/* would be nice to include input filenames and line numbers */ |
| 60 |
@@ -410,7 +410,7 @@ VERBSYMBOL =|\\leq|\\geq|\\in|>|<|\\subseteq|\subseteq|\\subset|\\supset|\\sim|\ |
| 61 |
<Normal>"\\includeonly" {BEGIN IncludeOnly; IGNORE;} |
| 62 |
<IncludeOnly>[^{ \t,\n}]+ AddInclude(yytext); |
| 63 |
<IncludeOnly>"}" { if (csbIncList == 0) |
| 64 |
- rgsbIncList[csbIncList++] = '\0'; |
| 65 |
+ *rgsbIncList[csbIncList++] = '\0'; |
| 66 |
BEGIN Normal; |
| 67 |
} |
| 68 |
<IncludeOnly>"\n"+ NEWLINE; |
| 69 |
@@ -821,8 +821,6 @@ EndEnv(const char *sbEnv) |
| 70 |
void |
| 71 |
InputFile(char *sbFile) |
| 72 |
{ |
| 73 |
- FILE *TexOpen(); |
| 74 |
- |
| 75 |
if (!fFollow) |
| 76 |
return; |
| 77 |
rgfp[cfp++] = yyin; |
| 78 |
@@ -847,8 +845,6 @@ InputFile(char *sbFile) |
| 79 |
void |
| 80 |
IncludeFile(char *sbFile) |
| 81 |
{ |
| 82 |
- FILE *TexOpen(); |
| 83 |
- |
| 84 |
if (!fFollow) |
| 85 |
return; |
| 86 |
if (!InList(sbFile)) |