This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug build/20993] New: gdb does not link, when flex v2.6.2-19-g6bea32e is used


https://sourceware.org/bugzilla/show_bug.cgi?id=20993

            Bug ID: 20993
           Summary: gdb does not link, when flex v2.6.2-19-g6bea32e is
                    used
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: build
          Assignee: unassigned at sourceware dot org
          Reporter: dilyan.palauzov at aegee dot org
  Target Milestone: ---

gdb/ada-lex.l contains
#define yytext ada_yytext
#define yywrap ada_yywrap

The most current flex v2.6.2-19-g6bea32e generates gdb/ada-lex.c containing:
    #define yytext yytext

In turn, gcc 6 states:

make[1]: Leaving directory '/root/binutils/gdb'
g++  -g -O2   -I. -I/git/binutils-gdb/gdb -I/git/binutils-gdb/gdb/common
-I/git/binutils-gdb/gdb/config -DLOCALEDIR="\"/usr/local/share/locale\""
-DHAVE_CONFIG_H -I/git/binutils-gdb/gdb/../include/opcode
-I/git/binutils-gdb/gdb/../opcodes/..   -I../bfd -I/git/binutils-gdb/gdb/../bfd
-I/git/binutils-gdb/gdb/../include -I../libdecnumber
-I/git/binutils-gdb/gdb/../libdecnumber  -I/git/binutils-gdb/gdb/gnulib/import
-Ibuild-gnulib/import   -DTUI=1   -pthread -I/usr/local/include/guile/2.0
-I/usr/local/include -I/usr/local/include/python3.5m
-I/usr/local/include/python3.5m -Wall -Wpointer-arith -Wno-unused
-Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body
-Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare
-Wno-write-strings -Wno-narrowing -Wformat-nonliteral -Werror `echo " -Wall
-Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch
-Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter
-Wunused-but-set-variable -Wno-sign-compare -Wno-write-strings -Wno-narrowing
-Wformat-nonliteral " | sed "s/ -Wold-style-definition /
-Wno-old-style-definition /g"` \
        -c -o ada-exp.o -MT ada-exp.o -MMD -MP -MF .deps/ada-exp.Tpo `if test
-f ada-exp.c; then echo ada-exp.c; else echo /git/binutils-gdb/gdb/ada-exp.c;
fi`
In file included from /git/binutils-gdb/gdb/ada-exp.y:731:0:
ada-lex.c:16:0: error: "yy_create_buffer" redefined [-Werror]


/git/binutils-gdb/gdb/ada-exp.y:717:0: note: this is the location of the
previous definition
 #define yy_create_buffer ada_yy_create_buffer

In file included from /git/binutils-gdb/gdb/ada-exp.y:731:0:
ada-lex.c:18:0: error: "yy_delete_buffer" redefined [-Werror]


/git/binutils-gdb/gdb/ada-exp.y:718:0: note: this is the location of the
previous definition
 #define yy_delete_buffer ada_yy_delete_buffer

In file included from /git/binutils-gdb/gdb/ada-exp.y:731:0:
ada-lex.c:26:0: error: "yy_init_buffer" redefined [-Werror]


/git/binutils-gdb/gdb/ada-exp.y:719:0: note: this is the location of the
previous definition
 #define yy_init_buffer ada_yy_init_buffer

In file included from /git/binutils-gdb/gdb/ada-exp.y:731:0:
ada-lex.c:30:0: error: "yy_load_buffer_state" redefined [-Werror]


/git/binutils-gdb/gdb/ada-exp.y:720:0: note: this is the location of the
previous definition
 #define yy_load_buffer_state ada_yy_load_buffer_state

In file included from /git/binutils-gdb/gdb/ada-exp.y:731:0:
ada-lex.c:32:0: error: "yy_switch_to_buffer" redefined [-Werror]


/git/binutils-gdb/gdb/ada-exp.y:721:0: note: this is the location of the
previous definition
 #define yy_switch_to_buffer ada_yy_switch_to_buffer

In file included from /git/binutils-gdb/gdb/ada-exp.y:731:0:
ada-lex.c:40:0: error: "yylex" redefined [-Werror]


In file included from /git/binutils-gdb/gdb/ada-exp.y:56:0:
/git/binutils-gdb/gdb/yy-remap.h:41:0: note: this is the location of the
previous definition
 #define yylex  GDB_YY_REMAP (yylex)

In file included from /git/binutils-gdb/gdb/ada-exp.y:731:0:
ada-lex.c:42:0: error: "yyrestart" redefined [-Werror]


/git/binutils-gdb/gdb/ada-exp.y:722:0: note: this is the location of the
previous definition
 #define yyrestart ada_yyrestart

In file included from /git/binutils-gdb/gdb/ada-exp.y:731:0:
ada-lex.c:74:0: error: "yywrap" redefined [-Werror]


/git/binutils-gdb/gdb/ada-exp.y:724:0: note: this is the location of the
previous definition
 #define yywrap ada_yywrap

In file included from /git/binutils-gdb/gdb/ada-exp.y:731:0:
ada-lex.c:82:0: error: "yytext" redefined [-Werror]


/git/binutils-gdb/gdb/ada-exp.y:723:0: note: this is the location of the
previous definition
 #define yytext ada_yytext

In file included from /git/binutils-gdb/gdb/ada-exp.y:731:0:
ada-lex.c:398:0: error: "yywrap" redefined [-Werror]


In file included from /git/binutils-gdb/gdb/ada-exp.y:731:0:
ada-lex.c:74:0: note: this is the location of the previous definition


In file included from /git/binutils-gdb/gdb/ada-exp.y:56:0:
/git/binutils-gdb/gdb/ada-exp.y:55:29: error: ‘int ada_yylex()’ declared
‘static’ but never defined [-Werror=unused-function]
 #define GDB_YY_REMAP_PREFIX ada_
                             ^
/git/binutils-gdb/gdb/yy-remap.h:35:39: note: in definition of macro
‘GDB_YY_REMAP_2’
 #define GDB_YY_REMAP_2(PREFIX, YYSYM) PREFIX ## YYSYM
                                       ^~~~~~
/git/binutils-gdb/gdb/yy-remap.h:37:29: note: in expansion of macro
‘GDB_YY_REMAP_1’
 #define GDB_YY_REMAP(YYSYM) GDB_YY_REMAP_1 (GDB_YY_REMAP_PREFIX, YYSYM)
                             ^~~~~~~~~~~~~~
/git/binutils-gdb/gdb/yy-remap.h:37:45: note: in expansion of macro
‘GDB_YY_REMAP_PREFIX’
 #define GDB_YY_REMAP(YYSYM) GDB_YY_REMAP_1 (GDB_YY_REMAP_PREFIX, YYSYM)
                                             ^~~~~~~~~~~~~~~~~~~
/git/binutils-gdb/gdb/yy-remap.h:41:16: note: in expansion of macro
‘GDB_YY_REMAP’
 #define yylex  GDB_YY_REMAP (yylex)
                ^~~~~~~~~~~~
/git/binutils-gdb/gdb/ada-exp.y:78:12: note: in expansion of macro ‘yylex’
 static int yylex (void);
            ^~~~~
In file included from /git/binutils-gdb/gdb/ada-exp.y:731:0:
ada-lex.c:40:19: error: ‘int yylex()’ defined but not used
[-Werror=unused-function]

                   ^
/git/binutils-gdb/gdb/ada-lex.l:60:28: note: in expansion of macro ‘yylex’
 #define YY_DECL static int yylex ( void )
                            ^~~~~
ada-lex.c:1126:1: note: in expansion of macro ‘YY_DECL’
  */
 ^~~    
cc1plus: all warnings being treated as errors
make: *** [Makefile:2680: ada-exp.o] Error 1


Removing -Werror does not help:  

nm -C ada-exp.o|grep lex
0000000000000000 D ada_flex_use
                 U lexptr
0000000000000008 B yy_flex_debug
0000000000001d10 T yylex_destroy()
                 U ada_yylex()

make
rm -f gdb
g++  -g -O2   -static-libstdc++ -static-libgcc    \
        -o gdb gdb.o amd64-tdep.o amd64-linux-tdep.o i386-tdep.o i387-tdep.o
i386-linux-tdep.o glibc-tdep.o solib-svr4.o symfile-mem.o linux-tdep.o
linux-record.o ser-base.o ser-unix.o ser-pipe.o ser-tcp.o inf-ptrace.o
fork-child.o x86-nat.o x86-dregs.o amd64-nat.o amd64-linux-nat.o
x86-linux-nat.o linux-nat.o linux-osdata.o proc-service.o linux-thread-db.o
linux-fork.o linux-procfs.o linux-ptrace.o linux-btrace.o linux-waitpid.o
linux-personality.o x86-linux.o x86-linux-dregs.o amd64-linux-siginfo.o
linux-namespaces.o ax-gdb.o ax-general.o ctf.o dcache.o remote.o
remote-fileio.o remote-notif.o tracefile.o tracefile-tfile.o tracepoint.o 
cli-cmds.o cli-decode.o cli-dump.o cli-interp.o cli-logging.o cli-script.o
cli-setshow.o cli-utils.o mi-cmd-break.o mi-cmd-catch.o mi-cmd-disas.o
mi-cmd-env.o mi-cmd-file.o mi-cmd-info.o mi-cmd-stack.o mi-cmd-target.o
mi-cmd-var.o mi-cmds.o mi-console.o mi-getopt.o mi-interp.o mi-main.o mi-out.o
mi-parse.o mi-symbol-cmds.o tui.o tui-command.o tui-data.o tui-disasm.o
tui-file.o tui-hooks.o tui-interp.o tui-io.o tui-layout.o tui-out.o tui-regs.o
tui-source.o tui-stack.o tui-win.o tui-windata.o tui-wingeneral.o
tui-winsource.o py-arch.o py-auto-load.o py-block.o py-bpevent.o
py-breakpoint.o py-cmd.o py-continueevent.o py-event.o py-evtregistry.o
py-evts.o py-exitedevent.o py-finishbreakpoint.o py-frame.o py-framefilter.o
py-function.o py-gdb-readline.o py-inferior.o py-infevents.o py-infthread.o
py-lazy-string.o py-linetable.o py-newobjfileevent.o py-objfile.o py-param.o
py-prettyprint.o py-progspace.o py-signalevent.o py-stopevent.o py-symbol.o
py-symtab.o py-threadevent.o py-type.o py-unwind.o py-utils.o py-value.o
py-varobj.o py-xmethods.o python.o guile.o scm-arch.o scm-auto-load.o
scm-block.o scm-breakpoint.o scm-cmd.o scm-disasm.o scm-exception.o scm-frame.o
scm-gsmob.o scm-iterator.o scm-lazy-string.o scm-math.o scm-objfile.o
scm-param.o scm-ports.o scm-pretty-print.o scm-progspace.o scm-safe-call.o
scm-string.o scm-symbol.o scm-symtab.o scm-type.o scm-utils.o scm-value.o
elfread.o stap-probe.o dtrace-probe.o posix-hdep.o posix-strerror.o ada-exp.o
c-exp.o cp-name-parser.o d-exp.o f-exp.o go-exp.o m2-exp.o p-exp.o rust-exp.o
ada-lang.o ada-tasks.o ada-typeprint.o ada-valprint.o ada-varobj.o addrmap.o
agent.o annotate.o arch-utils.o auto-load.o auxv.o bcache.o bfd-target.o
block.o blockframe.o break-catch-sig.o break-catch-syscall.o
break-catch-throw.o breakpoint.o btrace.o btrace-common.o buffer.o build-id.o
buildsym.o c-lang.o c-typeprint.o c-valprint.o c-varobj.o charset.o cleanups.o
cli-out.o coff-pe-read.o coffread.o common-agent.o common-debug.o
common-exceptions.o common-regcache.o common-utils.o complaints.o completer.o
continuations.o copying.o corefile.o corelow.o cp-abi.o cp-namespace.o
cp-support.o cp-valprint.o d-lang.o d-namespace.o d-valprint.o dbxread.o
debug.o demangle.o dfp.o dictionary.o disasm.o doublest.o dummy-frame.o
dwarf2-frame.o dwarf2-frame-tailcall.o dwarf2expr.o dwarf2loc.o dwarf2read.o
environ.o errors.o eval.o event-loop.o event-top.o exceptions.o exec.o
expprint.o extension.o f-lang.o f-typeprint.o f-valprint.o fileio.o filestuff.o
filesystem.o findcmd.o findvar.o format.o frame.o frame-base.o frame-unwind.o
gcore.o gdb_bfd.o gdb-dlfcn.o gdb_obstack.o gdb_usleep.o gdb_vecs.o gdbarch.o
gdbtypes.o gnu-v2-abi.o gnu-v3-abi.o go-lang.o go-typeprint.o go-valprint.o
inf-child.o inf-loop.o infcall.o infcmd.o inferior.o infrun.o inline-frame.o
interps.o jit.o language.o linespec.o location.o m2-lang.o m2-typeprint.o
m2-valprint.o macrocmd.o macroexp.o macroscope.o macrotab.o main.o maint.o
mdebugread.o mem-break.o memattr.o memory-map.o memrange.o mi-common.o
minidebug.o minsyms.o mipsread.o namespace.o new-op.o objc-lang.o objfiles.o
observer.o opencl-lang.o osabi.o osdata.o p-lang.o p-typeprint.o p-valprint.o
parse.o print-utils.o printcmd.o probe.o progspace.o prologue-value.o psymtab.o
ptid.o record.o record-btrace.o record-full.o regcache.o reggroups.o registry.o
reverse.o rsp-low.o run-time-clock.o rust-lang.o selftest.o sentinel-frame.o
ser-event.o serial.o signals.o signals-state-save-restore.o skip.o solib.o
solib-target.o source.o stabsread.o stack.o std-regs.o symfile.o
symfile-debug.o symmisc.o symtab.o target.o target-dcache.o
target-descriptions.o target-memory.o thread.o thread-fsm.o tid-parse.o top.o
trad-frame.o tramp-frame.o typeprint.o ui-file.o ui-out.o user-regs.o utils.o
utils-selftests.o valarith.o valops.o valprint.o value.o varobj.o vec.o
version.o waitstatus.o xml-builtin.o xml-support.o xml-syscall.o xml-tdesc.o
xml-utils.o compile.o compile-c-support.o compile-c-symbols.o compile-c-types.o
compile-loc2c.o compile-object-load.o compile-object-run.o inflow.o    init.o \
           -lreadline ../opcodes/libopcodes.a ../bfd/libbfd.a -lz 
../libiberty/libiberty.a ../libdecnumber/libdecnumber.a    -ldl -ldl -lncurses
-lm -ldl  -L/usr/local/lib -lguile-2.0 -lgc -lpthread -ldl -lutil -lm
-lpython3.5m /usr/local/lib/libexpat.so -L/lib64 -Wl,-rpath -Wl,/usr/local/lib
/usr/local/lib/liblzma.so -Wl,-rpath -Wl,/usr/local/lib  
../libiberty/libiberty.a  build-gnulib/import/libgnu.a  -ldl
-Wl,--dynamic-list=/git/binutils-gdb/gdb/proc-service.list
ada-exp.o: In function `ada_yyparse()':
/root/binutils/gdb/ada-exp.c:1586: undefined reference to `ada_yylex()'
collect2: error: ld returned 1 exit status

If i remove 

--- ada-lex.c   2016-12-23 20:21:13.444000000 +0000
+++ ada-lex.c~  2016-12-23 20:01:47.328000000 +0000
@@ -14,6 +14,83 @@
 #define FLEX_BETA
 #endif

+    #define yy_create_buffer yy_create_buffer
+
+    #define yy_delete_buffer yy_delete_buffer
+
+    #define yy_scan_buffer yy_scan_buffer
+
+    #define yy_scan_string yy_scan_string
+
+    #define yy_scan_bytes yy_scan_bytes
+
+    #define yy_init_buffer yy_init_buffer
+
+    #define yy_flush_buffer yy_flush_buffer
+
+    #define yy_load_buffer_state yy_load_buffer_state
+
+    #define yy_switch_to_buffer yy_switch_to_buffer
+
+    #define yypush_buffer_state yypush_buffer_state
+
+    #define yypop_buffer_state yypop_buffer_state
+
+    #define yyensure_buffer_stack yyensure_buffer_stack
+
+    #define yylex yylex
+
+    #define yyrestart yyrestart
+
+    #define yylex_init yylex_init
+
+    #define yylex_init_extra yylex_init_extra
+
+    #define yylex_destroy yylex_destroy
+
+    #define yyget_debug yyget_debug
+
+    #define yyset_debug yyset_debug
+
+    #define yyget_extra yyget_extra
+
+    #define yyset_extra yyset_extra
+
+    #define yyget_in yyget_in
+
+    #define yyset_in yyset_in
+
+    #define yyget_out yyget_out
+
+    #define yyset_out yyset_out
+
+    #define yyget_leng yyget_leng
+
+    #define yyget_text yyget_text
+
+    #define yyget_lineno yyget_lineno
+
+    #define yyset_lineno yyset_lineno
+
+    #define yywrap yywrap
+
+    #define yyalloc yyalloc
+
+    #define yyxrealloc yyxrealloc
+
+    #define yyfree yyfree
+
+    #define yytext yytext
+
+    #define yyleng yyleng
+
+    #define yyin yyin
+
+    #define yyout yyout
+
+    #define yy_flex_debug yy_flex_debug
+
+    #define yylineno yylineno

 /* First, we deal with  platform-specific or compiler-specific issues. */

Then everything is fine.

Why don't you just use "%option prefix" to prepend "ada_yy" to the generated
functions?

Please add "noyywrap" to the %options line in binutils/(ar,def,sys)lex.l,
gas/(itbl,config/bfin)-lex.l, gdb/ada-lex.l and ld/lex.l and remove the "int
wrap (void) {return 1;} definition.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]