Bug 30286 - Build error in split-name.h macro DOT
Summary: Build error in split-name.h macro DOT
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: build (show other bugs)
Version: HEAD
: P2 enhancement
Target Milestone: 14.1
Assignee: Tom Tromey
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-29 14:15 UTC by Xinyu Lu
Modified: 2023-09-15 13:51 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2023-09-12 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xinyu Lu 2023-03-29 14:15:28 UTC
When I build gdb in Mac OS 13.2.1 (22D68), it report error here.
The macro DOT is conflate with enum split_style::DOT. Maybe we 
should replace one of the

./split-name.h:34:3: error: expected identifier
  DOT,
  ^
m2-exp.c:163:13: note: expanded from macro 'DOT'
#define DOT 302
            ^
In file included from m2-exp.y:42:
In file included from ./language.h:26:
./symtab.h:308:23: error: expected unqualified-id
        style = split_style::DOT;
                             ^
m2-exp.c:163:13: note: expanded from macro 'DOT'
#define DOT 302
Comment 1 Simon Marchi 2023-03-30 14:12:49 UTC
On Linux, my generated m2-exp.c also contains a `#define DOT 302`, and I don't see that problem.  Out of curiosity, which bison/yacc tool version is used in your build to convert m2-exp.y to m2-exp.c?  Can you attach the generated m2-exp.c file?
Comment 2 Tom de Vries 2023-08-28 05:10:09 UTC
Another report of this PR here ( https://sourceware.org/pipermail/gdb/2023-August/050862.html ), mentioning GNU Bison 2.3.
Comment 3 Tom Tromey 2023-08-28 14:02:09 UTC
Bison 2.3, released in 2006, with many releases after...
maybe this is another one of those "Apple hates GPLv3" things?
I'd suggest trying to build with a bison from brew.  However
if we know that 2.3 works otherwise, I guess it is pretty
easy to rename split_style::DOT.
But -- do we know this?
Comment 4 Tom Tromey 2023-09-15 13:41:05 UTC
Sending a fix.
Comment 5 Sourceware Commits 2023-09-15 13:47:06 UTC
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fe26aa95336c0ddec01b407b990caf2c758fd93f

commit fe26aa95336c0ddec01b407b990caf2c758fd93f
Author: Tom Tromey <tromey@adacore.com>
Date:   Thu Aug 31 07:33:34 2023 -0600

    Rename split_style::DOT
    
    This renames split_style::DOT, to avoid name clashes when building gdb
    with an old version of Bison (2.3, the version available on macOS).
    
    In particular the error looks like:
    
    ./split-name.h:34:3: error: expected identifier
      DOT,
      ^
    m2-exp.c:163:13: note: expanded from macro 'DOT'
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30286
Comment 6 Tom Tromey 2023-09-15 13:51:19 UTC
Fixed.