Compilation error with gcc 4.0.1 +quick fix
David Hill <[email protected]>
| Newsgroups | gmane.comp.gnu.indent.bugs |
|---|---|
| Message-ID | <[email protected]> |
It wouldn't compile as-is. What I did: ./configure make Error: output.c:26: error: static declaration of ‘output’ follows non-static declaration indent.h:100: error: previous declaration of ‘output’ was here This was with gcc 4.0.1. How I fixed it: #ifndef so 'output' isn't declared in indent.h when output.c includes it. #define before output.c includes indent.h #undef after This is just a quick fix, there is probably a much cleaner way to do it. Anyway, I'm including diffs of the two files I changed. Thanks, David Hill. *** indent-old.h 2002-11-11 10:02:48.000000000 +1300 --- indent.h 2005-10-27 20:03:53.000000000 +1300 *************** *** 96,105 **** /* Size of the input program, not including the ' \n\0' we add at the end */ extern unsigned long in_prog_size; /* The output file. */ extern FILE *output; ! ! extern char *labbuf; /* buffer for label */ extern char *s_lab; /* start ... */ --- 96,105 ---- /* Size of the input program, not including the ' \n\0' we add at the end */ extern unsigned long in_prog_size; + #ifndef OUTPUT_INCLUDE /* The output file. */ extern FILE *output; ! #endif extern char *labbuf; /* buffer for label */ extern char *s_lab; /* start ... */ *** output-old.c 2002-12-13 06:36:49.000000000 +1300 --- output.c 2005-10-27 20:56:57.000000000 +1300 *************** *** 16,22 **** --- 16,27 ---- #include <utime.h> #include <sys/stat.h> + #define OUTPUT_INCLUDE + #include "indent.h" + + #undef OUTPUT_INCLUDE + #include "sys.h" #include "globs.h" #include "output.h"