bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: syntax_error constructor is declared inline


From: Kaz Kylheku
Subject: Re: syntax_error constructor is declared inline
Date: Wed, 14 Mar 2018 11:22:14 -0700
User-agent: Roundcube Webmail/0.9.2

On 2018-03-13 13:31, Hans Åberg wrote:
On 12 Mar 2018, at 20:08, Vishal V <address@hidden> wrote:

Bison 3.0.4 marks the constructor for the syntax_error class as 'inline' when generating a C++ scanner, which results in undefined references when the exception is thrown from a separate scanner file. Since this is the
stated purpose of the syntax_error class (see
http://lists.gnu.org/archive/html/help-bison/2013-07/msg00010.html), this
appears to be a bug.

As a workaround, you might try removing the inline specifier by adding
to the .yy grammar file:
%code {
  ...
  #define inline
  ...
}

The developers of this stuff are pretty fucking careless about what goes into these skeleton files.

They think they can just throw in random new stuff and nobody's build will break.

Here is a rule from a production Makefile to remove // comments in Lex code that prevent it from being C90:

lex.yy.c: $(top_srcdir)parser.l
        $(call ABBREV,LEX)
        $(call SH,rm -f $@)
        $(call SH,                                              \
          if $(TXR_LEX) $(LEX_DBG_FLAGS) $< ; then              \
            sed -e s@//.*@@ < $@ > address@hidden ;                     \
            mv address@hidden $@ ;                                      \
          else                                                  \
            exit 1 ;                                            \
          fi)
        $(call SH,chmod a-w $@)

Commit: http://www.kylheku.com/cgit/txr/commit/?id=038bed1fa17743cbbfe4d219b6798d88254eef2c

Here is build recipe which removes an unwanted/incorrect yyparse declaration from y.tab.h:

y.tab.c: $(top_srcdir)parser.y
        $(call ABBREV,YACC)
        $(call SH,                                              \
          if [ -e y.tab.h ]; then mv y.tab.h y.tab.h.old ; fi)
        $(call SH,rm -f y.tab.c)
        $(call SH,                                              \
          if $(TXR_YACC) -v -d $< ; then                        \
            chmod a-w y.tab.c ;                                 \
            sed -e '/yyparse/d' < y.tab.h > y.tab.h.tmp &&      \
              mv y.tab.h.tmp y.tab.h ;                          \
            if cmp -s y.tab.h y.tab.h.old ; then                \
              mv y.tab.h.old y.tab.h ;                          \
            fi ;                                                \
          else                                                  \
            rm y.tab.c ;                                        \
            false ;                                             \
          fi)


Commit: http://www.kylheku.com/cgit/txr/commit/?id=fdb54c85577859e26525463c2e21801cd9b2377c



reply via email to

[Prev in Thread] Current Thread [Next in Thread]