use system rl headers, when --with-system-readline is provided

Message ID 55A38035.20602@aegee.org
State New, archived
Headers

Commit Message

Dilyan Palauzov July 13, 2015, 9:09 a.m. UTC
  PR gdb/17077

Use system readline headers, instead the bundled ones, when gdb is 
configured --with-system-readline

When building tui/tui-io.c one can see in gcc -E still the bundled 
readline include files get used.

# 32 "./../opcodes/../readline/rltypedefs.h"
#define _FUNCTION_DEF

As the libreadline.{a,so} is linked from system it may lead to 
incompatible ABI.

The provided patch:

   -- makes use of the fact, that the preprocessor can differentiate 
between #include "file" and #include <file>, when proceeding paths;

   -- substitutes all occurrences of #include 
"readline/{readline,history,tilde}.h" with #include 
<readline/{readline,history,tilde}.h>;

   -- enables the project root directory for includes (from opcode), 
unconditionally only for #include "file", and for all includes ("",<>), 
when the bundled readline is built (using -iquote in place of -I);

   -- does not approach the problem for sim/erc32/sis.c.
  

Comments

Andreas Schwab July 13, 2015, 9:29 a.m. UTC | #1
Dilyan Palauzov <dilyan.palauzov@aegee.org> writes:

> diff --git a/gdb/Makefile.in b/gdb/Makefile.in
> index dfaa8a3..579d0dd 100644
> --- a/gdb/Makefile.in
> +++ b/gdb/Makefile.in
> @@ -468,7 +468,7 @@ OPCODES = $(OPCODES_DIR)/libopcodes.a
>  # versions?
>  OP_INCLUDE = $(INCLUDE_DIR)/opcode
>  # Some source files like to use #include "opcodes/file.h"
> -OPCODES_CFLAGS = -I$(OP_INCLUDE) -I$(OPCODES_SRC)/..
> +OPCODES_CFLAGS = -I$(OP_INCLUDE) -iquote$(OPCODES_SRC)/..

-iquote is gcc-only.

Andreas.
  
Dilyan Palauzov July 14, 2015, 1:21 p.m. UTC | #2
Hello Andreas,

clang-3.6 t.c -Wp,--help

prints:

USAGE: clang -cc1 [options] <inputs>

OPTIONS:

   -iquote <directory>     Add directory to QUOTE include search path

[with t.c: #include <stdio.h>
int main (int argc, char** argv) {printf("abc\n"); return 0;}]

Greetings
   Dilian

On 07/13/2015 11:29 AM, Andreas Schwab wrote:
> Dilyan Palauzov <dilyan.palauzov@aegee.org> writes:
>
>> diff --git a/gdb/Makefile.in b/gdb/Makefile.in
>> index dfaa8a3..579d0dd 100644
>> --- a/gdb/Makefile.in
>> +++ b/gdb/Makefile.in
>> @@ -468,7 +468,7 @@ OPCODES = $(OPCODES_DIR)/libopcodes.a
>>   # versions?
>>   OP_INCLUDE = $(INCLUDE_DIR)/opcode
>>   # Some source files like to use #include "opcodes/file.h"
>> -OPCODES_CFLAGS = -I$(OP_INCLUDE) -I$(OPCODES_SRC)/..
>> +OPCODES_CFLAGS = -I$(OP_INCLUDE) -iquote$(OPCODES_SRC)/..
>
> -iquote is gcc-only.
>
> Andreas.
>
  
Dilyan Palauzov July 14, 2015, 1:33 p.m. UTC | #3
For the record, the -Wmissing-parameter-type and -Wold-style-declaration 
from gdb/configure.ac are not supported by clang.

On 07/14/2015 03:21 PM, Dilyan Palauzov wrote:
> Hello Andreas,
>
> clang-3.6 t.c -Wp,--help
>
> prints:
>
> USAGE: clang -cc1 [options] <inputs>
>
> OPTIONS:
>
>    -iquote <directory>     Add directory to QUOTE include search path
>
> [with t.c: #include <stdio.h>
> int main (int argc, char** argv) {printf("abc\n"); return 0;}]
>
> Greetings
>    Dilian
>
> On 07/13/2015 11:29 AM, Andreas Schwab wrote:
>> Dilyan Palauzov <dilyan.palauzov@aegee.org> writes:
>>
>>> diff --git a/gdb/Makefile.in b/gdb/Makefile.in
>>> index dfaa8a3..579d0dd 100644
>>> --- a/gdb/Makefile.in
>>> +++ b/gdb/Makefile.in
>>> @@ -468,7 +468,7 @@ OPCODES = $(OPCODES_DIR)/libopcodes.a
>>>   # versions?
>>>   OP_INCLUDE = $(INCLUDE_DIR)/opcode
>>>   # Some source files like to use #include "opcodes/file.h"
>>> -OPCODES_CFLAGS = -I$(OP_INCLUDE) -I$(OPCODES_SRC)/..
>>> +OPCODES_CFLAGS = -I$(OP_INCLUDE) -iquote$(OPCODES_SRC)/..
>>
>> -iquote is gcc-only.
>>
>> Andreas.
>>
  
Mike Frysinger July 15, 2015, 7:57 a.m. UTC | #4
On 14 Jul 2015 15:21, Dilyan Palauzov wrote:
> Hello Andreas,
> 
> clang-3.6 t.c -Wp,--help
> 
> prints:
> 
> USAGE: clang -cc1 [options] <inputs>
> 
> OPTIONS:
> 
>    -iquote <directory>     Add directory to QUOTE include search path
> 
> [with t.c: #include <stdio.h>
> int main (int argc, char** argv) {printf("abc\n"); return 0;}]

are you going to verify every system/compiler for us ?
off hand, people routinely build on AIX too.
-mike
  

Patch

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index dfaa8a3..579d0dd 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -468,7 +468,7 @@  OPCODES = $(OPCODES_DIR)/libopcodes.a
  # versions?
  OP_INCLUDE = $(INCLUDE_DIR)/opcode
  # Some source files like to use #include "opcodes/file.h"
-OPCODES_CFLAGS = -I$(OP_INCLUDE) -I$(OPCODES_SRC)/..
+OPCODES_CFLAGS = -I$(OP_INCLUDE) -iquote$(OPCODES_SRC)/..

  # The simulator is usually nonexistent; targets that include one
  # should set this to list all the .o or .a files to be linked in.
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index 7da288f..879faa0 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -33,7 +33,7 @@ 
  #include "cli/cli-decode.h"
  #include "cli/cli-setshow.h"
  #include "gdb_vecs.h"
-#include "readline/tilde.h"
+#include <readline/tilde.h>
  #include "completer.h"
  #include "fnmatch.h"
  #include "top.h"
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index af0d167..e7380d2 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -69,8 +69,8 @@ 
  #include "format.h"

  /* readline include files */
-#include "readline/readline.h"
-#include "readline/history.h"
+#include <readline/readline.h>
+#include <readline/history.h>

  /* readline defines this.  */
  #undef savestring
diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c
index 365c166..c784ea4 100644
--- a/gdb/bsd-kvm.c
+++ b/gdb/bsd-kvm.c
@@ -33,7 +33,7 @@ 
  #include <nlist.h>
  #endif
  #include <paths.h>
-#include "readline/readline.h"
+#include <readline/readline.h>
  #include <sys/param.h>
  #include <sys/proc.h>
  #include <sys/user.h>
diff --git a/gdb/cli-out.c b/gdb/cli-out.c
index 2a83169..7c891d1 100644
--- a/gdb/cli-out.c
+++ b/gdb/cli-out.c
@@ -25,7 +25,7 @@ 
  #include "cli-out.h"
  #include "completer.h"
  #include "vec.h"
-#include "readline/readline.h"
+#include <readline/readline.h>

  typedef struct cli_ui_out_data cli_out_data;

diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 2ec2dd3..07e6870 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -20,8 +20,8 @@ 
  #include "defs.h"
  #include "arch-utils.h"
  #include "dyn-string.h"
-#include "readline/readline.h"
-#include "readline/tilde.h"
+#include <readline/readline.h>
+#include <readline/tilde.h>
  #include "completer.h"
  #include "target.h"	/* For baud_rate, remote_debug and remote_timeout.  */
  #include "gdb_wait.h"	/* For shell escape implementation.  */
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index 2449dc5..6851873 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -26,7 +26,7 @@ 
  #include "completer.h"
  #include <ctype.h>
  #include "target.h"
-#include "readline/readline.h"
+#include <readline/readline.h>
  #include "gdbcore.h"
  #include "cli/cli-utils.h"
  #include "gdb_bfd.h"
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index 8d01b52..7cf5b95 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -16,7 +16,7 @@ 
     along with this program.  If not, see 
<http://www.gnu.org/licenses/>.  */

  #include "defs.h"
-#include "readline/tilde.h"
+#include <readline/tilde.h>
  #include "value.h"
  #include <ctype.h>
  #include "arch-utils.h"
diff --git a/gdb/compile/compile-object-load.c 
b/gdb/compile/compile-object-load.c
index 8298748..9f17826 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -23,7 +23,7 @@ 
  #include "command.h"
  #include "objfiles.h"
  #include "gdbcore.h"
-#include "readline/tilde.h"
+#include <readline/tilde.h>
  #include "bfdlink.h"
  #include "gdbcmd.h"
  #include "regcache.h"
diff --git a/gdb/completer.c b/gdb/completer.c
index fd52a04..abaeeb4 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -36,7 +36,7 @@ 

  /* Needed for rl_completer_word_break_characters() and for
     rl_filename_completion_function.  */
-#include "readline/readline.h"
+#include <readline/readline.h>

  /* readline defines this.  */
  #undef savestring
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 9218003..ffe5e50 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -37,7 +37,7 @@ 
  #include "regset.h"
  #include "symfile.h"
  #include "exec.h"
-#include "readline/readline.h"
+#include <readline/readline.h>
  #include "solib.h"
  #include "filenames.h"
  #include "progspace.h"
diff --git a/gdb/event-top.c b/gdb/event-top.c
index e9cc2d7..61dcd46 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -39,8 +39,8 @@ 
  #include "maint.h"

  /* readline include files.  */
-#include "readline/readline.h"
-#include "readline/history.h"
+#include <readline/readline.h>
+#include <readline/history.h>

  /* readline defines this.  */
  #undef savestring
diff --git a/gdb/exec.c b/gdb/exec.c
index 3dfc437..b09674e 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -37,7 +37,7 @@ 
  #include "gcore.h"

  #include <fcntl.h>
-#include "readline/readline.h"
+#include <readline/readline.h>
  #include "gdbcore.h"

  #include <ctype.h>
diff --git a/gdb/gcore.c b/gdb/gcore.c
index 44b9d0c..9da77e1 100644
--- a/gdb/gcore.c
+++ b/gdb/gcore.c
@@ -33,7 +33,7 @@ 
  #include "regcache.h"
  #include "regset.h"
  #include "gdb_bfd.h"
-#include "readline/tilde.h"
+#include <readline/tilde.h>

  /* The largest amount of memory to read from the target at once.  We
     must throttle it to limit the amount of memory used by GDB during
diff --git a/gdb/inferior.c b/gdb/inferior.c
index 5e98df5..dc47c09 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -34,7 +34,7 @@ 
  #include "continuations.h"
  #include "arch-utils.h"
  #include "target-descriptions.h"
-#include "readline/tilde.h"
+#include <readline/tilde.h>

  void _initialize_inferiors (void);

diff --git a/gdb/mingw-hdep.c b/gdb/mingw-hdep.c
index a0ed281..fecbba3 100644
--- a/gdb/mingw-hdep.c
+++ b/gdb/mingw-hdep.c
@@ -23,7 +23,7 @@ 
  #include "event-loop.h"

  #include "gdb_select.h"
-#include "readline/readline.h"
+#include <readline/readline.h>

  #include <windows.h>

diff --git a/gdb/monitor.c b/gdb/monitor.c
index 4657d73..1c22d4a 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -53,7 +53,7 @@ 
  #include "srec.h"
  #include "regcache.h"
  #include "gdbthread.h"
-#include "readline/readline.h"
+#include <readline/readline.h>
  #include "rsp-low.h"

  static char *dev_name;
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index ba677bc..b6b8ae5 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -29,7 +29,7 @@ 
  #include "bcache.h"
  #include "ui-out.h"
  #include "command.h"
-#include "readline/readline.h"
+#include <readline/readline.h>
  #include "gdb_regex.h"
  #include "dictionary.h"
  #include "language.h"
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 4f88b0e..b176d9e 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -29,7 +29,7 @@ 
  #include "language.h"
  #include "event-loop.h"
  #include "serial.h"
-#include "readline/tilde.h"
+#include <readline/tilde.h>
  #include "python.h"
  #include "extension-priv.h"
  #include "cli/cli-utils.h"
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 82c129d..319a676 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -38,7 +38,7 @@ 
  #include "regcache.h"
  #include "sim-regno.h"
  #include "arch-utils.h"
-#include "readline/readline.h"
+#include <readline/readline.h>
  #include "gdbthread.h"

  /* Prototypes */
diff --git a/gdb/solib.c b/gdb/solib.c
index eb933c0..7495cbb 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -39,7 +39,7 @@ 
  #include "exec.h"
  #include "solist.h"
  #include "observer.h"
-#include "readline/readline.h"
+#include <readline/readline.h>
  #include "remote.h"
  #include "solib.h"
  #include "interps.h"
diff --git a/gdb/source.c b/gdb/source.c
index fbec0f1..b3460c7 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -41,7 +41,7 @@ 
  #include "filenames.h"		/* for DOSish file names */
  #include "completer.h"
  #include "ui-out.h"
-#include "readline/readline.h"
+#include <readline/readline.h>

  #define OPEN_MODE (O_RDONLY | O_BINARY)
  #define FDOPEN_MODE FOPEN_RB
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 0c35ffa..ad76621 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -44,7 +44,7 @@ 
  #include "completer.h"
  #include "bcache.h"
  #include "hashtab.h"
-#include "readline/readline.h"
+#include <readline/readline.h>
  #include "block.h"
  #include "observer.h"
  #include "exec.h"
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index bee07ac..2758b81 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -36,7 +36,7 @@ 
  #include "typeprint.h"
  #include "gdbcmd.h"
  #include "source.h"
-#include "readline/readline.h"
+#include <readline/readline.h>

  #include "psymtab.h"

diff --git a/gdb/top.c b/gdb/top.c
index 1e30b1c..53ed999 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -51,8 +51,8 @@ 
  #include "filenames.h"

  /* readline include files.  */
-#include "readline/readline.h"
-#include "readline/history.h"
+#include <readline/readline.h>
+#include <readline/history.h>

  /* readline defines this.  */
  #undef savestring
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index 9747036..9f2472a 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -19,7 +19,7 @@ 

  #include "defs.h"
  #include "tracefile.h"
-#include "readline/tilde.h"
+#include <readline/tilde.h>
  #include "filestuff.h"
  #include "rsp-low.h" /* bin2hex */
  #include "regcache.h"
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 7c04ecb..3094efc 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -57,8 +57,8 @@ 
  #include "tracefile.h"

  /* readline include files */
-#include "readline/readline.h"
-#include "readline/history.h"
+#include <readline/readline.h>
+#include <readline/history.h>

  /* readline defines this.  */
  #undef savestring
diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index c885108..8b32f73 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -52,7 +52,7 @@ 
  /* This redefines CTRL if it is not already defined, so it must come
     after terminal state releated include files like <term.h> and
     "gdb_curses.h".  */
-#include "readline/readline.h"
+#include <readline/readline.h>

  int tui_target_has_run = 0;

diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c
index 1a5639d..3c353ec 100644
--- a/gdb/tui/tui-interp.c
+++ b/gdb/tui/tui-interp.c
@@ -25,7 +25,7 @@ 
  #include "ui-out.h"
  #include "cli-out.h"
  #include "tui/tui-data.h"
-#include "readline/readline.h"
+#include <readline/readline.h>
  #include "tui/tui-win.h"
  #include "tui/tui.h"
  #include "tui/tui-io.h"
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index 97906ce..4b38e7c 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -43,7 +43,7 @@ 
  /* This redefines CTRL if it is not already defined, so it must come
     after terminal state releated include files like <term.h> and
     "gdb_curses.h".  */
-#include "readline/readline.h"
+#include <readline/readline.h>

  int
  key_is_start_sequence (int ch)
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index cdf322b..6487166 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -48,7 +48,7 @@ 

  #include "gdb_curses.h"
  #include <ctype.h>
-#include "readline/readline.h"
+#include <readline/readline.h>

  #include <signal.h>

diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index 838471d..7fa6e3c 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -53,7 +53,7 @@ 
  /* This redefines CTRL if it is not already defined, so it must come
     after terminal state releated include files like <term.h> and
     "gdb_curses.h".  */
-#include "readline/readline.h"
+#include <readline/readline.h>

  /* Tells whether the TUI is active or not.  */
  int tui_active = 0;
diff --git a/gdb/utils.c b/gdb/utils.c
index acb4c7d..289a1a1 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -60,7 +60,7 @@ 

  #include "gdb_curses.h"

-#include "readline/readline.h"
+#include <readline/readline.h>

  #include <sys/time.h>
  #include <time.h>