MagLev / maglev

GemStone Maglev Ruby Repository
http://maglev.github.io
518 stars 43 forks source link

Includes inttypes.h for PRIdPTR formatting macro #443

Closed johnnyt closed 8 years ago

johnnyt commented 8 years ago

Closes #442

krono commented 8 years ago

Ok, I just found why this does not work.

ICU4C already includes inttypes.h, but whithout __STDC_FORMAT_MACROS being defined under C++ (which we are using) the print macros arent there.

Our definition of __STDC_FORMAT_MACROS is therefore too late.

Two possibilities here:

  1. Define __STDC_FORMAT_MACROS earlier in src/kernel/parser/byacc/skeleton.c, for example in the banner:

    const char *banner[] =
    {
        "#define YYBYACC 1",
        CONCAT1("#define YYMAJOR ", YYMAJOR),
        CONCAT1("#define YYMINOR ", YYMINOR),
    #ifdef YYPATCH
        CONCAT1("#define YYPATCH ", YYPATCH),
    #endif
        "",
        "enum {  YYEMPTY  =  -1 }; ",
        /* define yyclearin      (yychar = YYEMPTY) */ 
        /* define yyerrok        (yyerrflag = 0) , */
        /* define YYRECOVERING() (yyerrflag != 0) */ 
        "",
        "#define __STDC_FORMAT_MACROS 1 /* For C++ < C++11*/",
        0
    };
  2. Define __STDC_FORMAT_MACROS during invocation via Makefile and change CCDEF:

    CCDEF       := -DFLG_FAST=1 -DNOT_JAVA_VM -D_GNU_SOURCE -D_REENTRANT -D__STDC_FORMAT_MACROS

What is your preference, @AllenOtis ?

AllenOtis commented 8 years ago

I would rather see the change made in skeleton.c

On Tue, Sep 29, 2015 at 1:15 AM, Tobias Pape notifications@github.com wrote:

Ok, I just found why this does not work.

ICU4C already includes inttypes.h, but whithout __STDC_FORMAT_MACROS being defined under C++ (which we are using) the print macros arent there.

Our definition of __STDC_FORMAT_MACROS is therefore too late.

Two possibilities here:

1.

Define __STDC_FORMAT_MACROS earlier in src/kernel/parser/byacc/skeleton.c, for example in the banner:

const char _banner[] = { "#define YYBYACC 1", CONCAT1("#define YYMAJOR ", YYMAJOR), CONCAT1("#define YYMINOR ", YYMINOR),

ifdef YYPATCH

    CONCAT1("#define YYPATCH ", YYPATCH),
#endif
    "",
    "enum {  YYEMPTY  =  -1 }; ",
    /_ define yyclearin      (yychar = YYEMPTY) _/
    /_ define yyerrok        (yyerrflag = 0) , _/
    /_ define YYRECOVERING() (yyerrflag != 0) _/
    "",
    "#define __STDC_FORMAT_MACROS 1 /_ For C++ < C++11*/",
    0
};

2.

Define __STDC_FORMAT_MACROS during invocation via Makefile and change CCDEF:

CCDEF       := -DFLG_FAST=1 -DNOT_JAVA_VM -D_GNU_SOURCE -D_REENTRANT -D__STDC_FORMAT_MACROS

What is your preference, @AllenOtis https://github.com/AllenOtis ?

— Reply to this email directly or view it on GitHub https://github.com/MagLev/maglev/pull/443#issuecomment-143981454.

johnnyt commented 8 years ago

Awesome - thanks for your input @krono!