[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-readline] readline -vs- -Wstrict-prototypes
From: |
Tom Tromey |
Subject: |
[Bug-readline] readline -vs- -Wstrict-prototypes |
Date: |
Wed, 16 Mar 2011 09:15:53 -0600 |
We would like to use -Wstrict-prototypes for GDB. However, readline
headers prevent this.
There are a couple problems I am aware of.
First, rltypedefs.h defines some prototype-less typedefs by default,
e.g.:
typedef int Function ();
We would work around this with `#define _FUNCTION_DEF', but I think it
would be better for readline to just drop this code. C90 has been
widely deployed for a long time now; other GNU projects have
unconditionally dropped K&R compatibility quite a while ago.
If the workaround stays, I think the symbol should have an `RL' prefix.
Second, rl_message is declared without a prototype in some cases:
#if defined (USE_VARARGS) && defined (PREFER_STDARG)
extern int rl_message (const char *, ...) __attribute__((__format__ (printf,
1, 2)));
#else
extern int rl_message ();
#endif
However, I think USE_VARARGS is only defined in config.h, which is not
installed.
I think best practice for a library is to make an installable config.h
where all symbols are given the library prefix. That way it can be
included in other projects without danger of symbol clashes.
Tom
- [Bug-readline] readline -vs- -Wstrict-prototypes,
Tom Tromey <=