#84 Issue with g++ (GCC) 4.6.3 / parse_dataset.cpp and others



building the current SVN snapshot on Fedora 16 (g++ (GCC) 4.6.3 20120306 (Red Hat 4.6.3-2)) one gets following result:

g++ -DHAVE_CONFIG_H -I. -I.. -I../src/math -I../src/components -g -O2 -pipe -fno-exceptions -fno-rtti -fno-check-new -W -Wall -MT parse_dataset.o -MD -MP -MF .deps/parse_dataset.Tpo -c -o parse_dataset.o parse_dataset.cpp
parse_dataset.cpp: In function ‘int dataset_parse()’:
parse_dataset.cpp:1657:30: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
check_dataset.h:41:5: error: initializing argument 1 of ‘int dataset_error(char*)’ [-fpermissive]
parse_dataset.cpp:1772:36: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
make[3]: *** [parse_dataset.o] Error 1

As per my understanding the trouble is caused since in parse_dataset.cpp line 1635 char const *yymsgp = YY_("syntax error"); is a const and therefore cannot be changed, but is called at line 1814 int dataset_error (char * error) {} as non const (see also prototype in check_dataset.h). Since the pointer yymsgp is also changed at other lines (e.g. 1654) as per my understanding it should be considered to be non const (is this a bug?). Affected are all parser - files (not only parse_dataset.cpp).

I guess this turns out because this g++ is not called with -fpermissive during make. (if i add -fpermissive, the make goes through).

Best regards


  • Ricardo

    Ricardo - 2012-11-10

    Hi, you are right, that's where the problem is, I had the same issue and I solved it changing the arguments from char* to const char* in these files and functions:

    check_dataset.h: int dataset_error (char *); -> int dataset_error (const char *);
    parse_dataset.cpp: int dataset_error (char * error) {} -> int dataset_error (const char * error) {}

    check_touchstone.h: int touchstone_error (char *); -> int touchstone_error (const char *);
    parse_touchstone.cpp: int touchstone_error (char * error) {} -> int touchstone_error (const char * error) {}

    Do the same thing to the next files.

    check_citi.h, parse_citi.cpp
    check_zvr.h, parse_zvr.cpp
    check_mdl.h, parse_mdl.cpp
    check_cvs.h, parse_cvs.cpp
    check_netlist.h, parse_netlist.cpp
    check_spice.h, parse_spice.cpp
    check_vcd.h, parse_vcd.cpp

    Best regards.

  • Frans

    Frans - 2013-01-19

    This should be fixed by now

  • Frans

    Frans - 2013-01-19
    • status: open --> closed
    • milestone: -->

Log in to post a comment.