[M3devel] Sneaky C++isms in m3cc

Mika Nystrom mika at async.caltech.edu
Fri Apr 24 18:57:32 CEST 2009


As usual, my quest to switch to CM3 ends up in my attempting (usually
not very well) to bootstrap CM3.  This time I am trying to build with
cm3 5.3.1 on FreeBSD 4.11. 

The reason for this is that the "FreeBSD4" snapshot on elego does
not appear to be a FreeBSD4 snapshot at all.  Anyone know what OS
this builds on?  (Links to the 5.5.0 -min I contributed from a real
FreeBSD 4 system are broken, and I can't find the source myself.)

But enough of that.  I noticed the following in parse.c (under m3cc):

   2395 static void
   2396 m3cg_set_source_line (void)
   2397 {
   2398   INTEGER (i);
   2399
   2400   if (option_source_line_trace) fprintf(stderr, "  source line %4ld\n", i);
   2401 #ifdef USE_MAPPED_LOCATION
   2402   source_location s = linemap_line_start (line_table, i, 80);
   2403   input_location = s;
   2404 #else
   2405   input_line = i;
   2406 #endif
   2407 }

The code on line 2402 is a C++ism.  You cannot declare variables
in the middle of code in C.  Unless it has changed with the new
version of C, but it still won't build with older C compilers.  (I'm
using gcc 2.95.4)

    Mika




More information about the M3devel mailing list