* GDB -Wmissing-prototypes and flex troubles
@ 2012-06-12 23:20 Pierre Muller
2012-06-13 4:38 ` Joel Brobecker
0 siblings, 1 reply; 5+ messages in thread
From: Pierre Muller @ 2012-06-12 23:20 UTC (permalink / raw)
To: gdb; +Cc: 'Joel Brobecker'
I am working on MIPS CPU support
for Free Pascal and found a problem
inside GDB related to that.
I treid to set up a gdb automatic tester on
GCC compile farm gcc42.
muller@gcc42:~$ uname -a
Linux gcc42 2.6.27.1 #476 Tue Oct 20 14:25:23 CST 2009 mips64 GNU/Linux
But the compilation of GDB fails because the installed flex version
muller@gcc42:~$ flex --version
flex 2.5.33
(Cygwin installed flex 2.5.35 does add those prototypes)
Doesn't provide the missing prototypes required by the
use of this new warning used together with -Werror option.
I didn't really find any version requirement
for flex.
Should we:
1) Specify a minimal version for flex?
2) disable missing-prototypes option
for ada-exp.c compilation?
3) Do 2) if version if below
minimum version adding those prototypes?
Pierre Muller
Part of diff -u output:
--- ada-lex.c.mips 2012-06-12 17:04:54.789877300 +0200
+++ ada-lex.c 2012-06-12 17:11:39.852185300 +0200
@@ -9,7 +9,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 33
+#define YY_FLEX_SUBMINOR_VERSION 35
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
>>> Below
@@ -776,6 +889,35 @@
static int yy_init_globals (void );
+/* Accessor methods to globals.
+ These are made visible to non-reentrant scanners for convenience. */
+
+int yylex_destroy (void );
+
+int yyget_debug (void );
+
+void yyset_debug (int debug_flag );
+
+YY_EXTRA_TYPE yyget_extra (void );
+
+void yyset_extra (YY_EXTRA_TYPE user_defined );
+
+FILE *yyget_in (void );
+
+void yyset_in (FILE * in_str );
+
+FILE *yyget_out (void );
+
+void yyset_out (FILE * out_str );
+
+int yyget_leng (void );
+
+char *yyget_text (void );
+
+int yyget_lineno (void );
+
+void yyset_lineno (int line_number );
+
/* Macros after this point can all be overridden by user definitions in
* section 1.
*/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GDB -Wmissing-prototypes and flex troubles 2012-06-12 23:20 GDB -Wmissing-prototypes and flex troubles Pierre Muller @ 2012-06-13 4:38 ` Joel Brobecker 2012-06-13 5:58 ` Mark Kettenis 2012-06-13 7:43 ` Pierre Muller 0 siblings, 2 replies; 5+ messages in thread From: Joel Brobecker @ 2012-06-13 4:38 UTC (permalink / raw) To: Pierre Muller; +Cc: gdb > Should we: > 1) Specify a minimal version for flex? > 2) disable missing-prototypes option > for ada-exp.c compilation? > 3) Do 2) if version if below > minimum version adding those prototypes? The lazy way would be to require a minimal version for flex. I would be OK with that, although it is true that it is a bit of a shame that the user does not get an error at configure time. It should be relatively easy to do, except that this would force me to upgrade many installs of flex on some of AdaCore's machines. I don't mind doing the update too much, and I should, except I usually find out at the wrong moment, and I then just get past the error by copy/pasting the compile command, removing the -Werror flag, and then resume the build. And also, an error would be preventing people from building a release with an older version of flex, even though the warnings would be harmless and non-fatal. I don't think we want to unilaterally disable -Werror for ada-lex.c. We'd open the door to allowing warnings back in again, when we did all the work to clean them up. A variation of 3. Something like the following close to the start of ada-lex.l: #if <FLEX_VERSION> < <2.5.35> /* Older versions of flex do not provide prototypes for these functions. Provide them ourselves, to avoid -Wmissing-prototypes warnings. */ int yylex_destroy (void ); int yyget_debug (void ); void yyset_debug (int debug_flag ); YY_EXTRA_TYPE yyget_extra (void ); [...] #endif I am not completly sure that this is going to work, maybe if some types are missing, for instance. Or maybe the prototypes depend on the version of flex. With all this being said, your option (3) is attractive. Except that in terms of implementation, it forces us to have a special rules for ada-lex.o. All in all, I tend to vote for the status quo... -- Joel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GDB -Wmissing-prototypes and flex troubles 2012-06-13 4:38 ` Joel Brobecker @ 2012-06-13 5:58 ` Mark Kettenis 2012-06-13 7:43 ` Pierre Muller 1 sibling, 0 replies; 5+ messages in thread From: Mark Kettenis @ 2012-06-13 5:58 UTC (permalink / raw) To: brobecker; +Cc: pierre.muller, gdb > Date: Tue, 12 Jun 2012 21:37:48 -0700 > From: Joel Brobecker <brobecker@adacore.com> > > > Should we: > > 1) Specify a minimal version for flex? > > 2) disable missing-prototypes option > > for ada-exp.c compilation? > > 3) Do 2) if version if below > > minimum version adding those prototypes? > > The lazy way would be to require a minimal version for flex. > I would be OK with that, although it is true that it is a bit of > a shame that the user does not get an error at configure time. > It should be relatively easy to do, except that this would force > me to upgrade many installs of flex on some of AdaCore's machines. > I don't mind doing the update too much, and I should, except > I usually find out at the wrong moment, and I then just get past > the error by copy/pasting the compile command, removing the -Werror > flag, and then resume the build. And also, an error would be > preventing people from building a release with an older version > of flex, even though the warnings would be harmless and non-fatal. > > I don't think we want to unilaterally disable -Werror for ada-lex.c. > We'd open the door to allowing warnings back in again, when we did > all the work to clean them up. > > A variation of 3. Something like the following close to the start > of ada-lex.l: > > #if <FLEX_VERSION> < <2.5.35> > /* Older versions of flex do not provide prototypes for these functions. > Provide them ourselves, to avoid -Wmissing-prototypes warnings. */ > int yylex_destroy (void ); > int yyget_debug (void ); > void yyset_debug (int debug_flag ); > YY_EXTRA_TYPE yyget_extra (void ); > [...] > #endif > > I am not completly sure that this is going to work, maybe if some > types are missing, for instance. Or maybe the prototypes depend on > the version of flex. > > With all this being said, your option (3) is attractive. Except > that in terms of implementation, it forces us to have a special > rules for ada-lex.o. > > All in all, I tend to vote for the status quo... Same here. The version of flex in the OpenBSD base system reports itself as 2.5.4, yet I don't see the problem that Pierre reports. So it seems that the problem was introduced in a later version and then fixed again. Given that there is a workaround, and releases don't suffer from the problem because we disable -Werror there, I'd say we leave things as they are. ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: GDB -Wmissing-prototypes and flex troubles 2012-06-13 4:38 ` Joel Brobecker 2012-06-13 5:58 ` Mark Kettenis @ 2012-06-13 7:43 ` Pierre Muller 2012-06-13 19:36 ` Joel Brobecker 1 sibling, 1 reply; 5+ messages in thread From: Pierre Muller @ 2012-06-13 7:43 UTC (permalink / raw) To: 'Joel Brobecker', 'Mark Kettenis'; +Cc: gdb > Objet : Re: GDB -Wmissing-prototypes and flex troubles > > > Should we: > > 1) Specify a minimal version for flex? > > 2) disable missing-prototypes option > > for ada-exp.c compilation? > > 3) Do 2) if version if below > > minimum version adding those prototypes? > > The lazy way would be to require a minimal version for flex. > I would be OK with that, although it is true that it is a bit of > a shame that the user does not get an error at configure time. > It should be relatively easy to do, except that this would force > me to upgrade many installs of flex on some of AdaCore's machines. > I don't mind doing the update too much, and I should, except > I usually find out at the wrong moment, and I then just get past > the error by copy/pasting the compile command, removing the -Werror > flag, and then resume the build. And also, an error would be > preventing people from building a release with an older version > of flex, even though the warnings would be harmless and non-fatal. My problem is that I don't know how to be able to use the automatic tester on a machine that I don't own, meaning that I can't upgrade flex easily... > I don't think we want to unilaterally disable -Werror for ada-lex.c. > We'd open the door to allowing warnings back in again, when we did > all the work to clean them up. Please remember that ada-lex.c isn't compiled directly, it is included inside ada-exp.c source. > A variation of 3. Something like the following close to the start > of ada-lex.l: > > #if <FLEX_VERSION> < <2.5.35> > /* Older versions of flex do not provide prototypes for these functions. > Provide them ourselves, to avoid -Wmissing-prototypes warnings. */ > int yylex_destroy (void ); > int yyget_debug (void ); > void yyset_debug (int debug_flag ); > YY_EXTRA_TYPE yyget_extra (void ); > [...] > #endif > > I am not completly sure that this is going to work, maybe if some > types are missing, for instance. Or maybe the prototypes depend on > the version of flex. It will be even more tricky as Mark mentioned that version 2.5.4 does not seem to suffer from this problem... > With all this being said, your option (3) is attractive. Except > that in terms of implementation, it forces us to have a special > rules for ada-lex.o. The ruel should be for ada-exp.o > All in all, I tend to vote for the status quo... The automated script checks out a clean git HEAD, which means that the only way for me would be to added a global GDB_ERROR_CFLAGS="" which seems really a bad thing to do when you want to test that your patch is not going to hurt or give new warnings :( I solved it locally by downloading 2.5.35 sources, configuring, compiling and installing in my home directory... But this is not really a nice solution either. Pierre Muller ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GDB -Wmissing-prototypes and flex troubles 2012-06-13 7:43 ` Pierre Muller @ 2012-06-13 19:36 ` Joel Brobecker 0 siblings, 0 replies; 5+ messages in thread From: Joel Brobecker @ 2012-06-13 19:36 UTC (permalink / raw) To: Pierre Muller; +Cc: 'Mark Kettenis', gdb > I solved it locally by downloading 2.5.35 sources, > configuring, compiling and installing in my home directory... > But this is not really a nice solution either. That's what I do at AdaCore too, because I don't want to burden the sysadmins with upgrading all our machines. I think that this is the best solution, I'm afraid, because it'll allow you to catch new warnings that might be introduced in ada-lex.l as well. If you prefer, we could think of trying to find an autoconf test for that, and then use it to decide whether ada-exp.c should be built with or without -Werror. I don't know how easy it would be to implement the autoconf check, though. I guess we could just use a dummy lex file, and then compile the transformed file... If you really prefer to go that route, I'll review the patches. -- Joel ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-06-13 19:36 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-06-12 23:20 GDB -Wmissing-prototypes and flex troubles Pierre Muller 2012-06-13 4:38 ` Joel Brobecker 2012-06-13 5:58 ` Mark Kettenis 2012-06-13 7:43 ` Pierre Muller 2012-06-13 19:36 ` Joel Brobecker
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).