Mercurial > ~dholland > hg > tradcpp > index.cgi
comparison macro.c @ 84:7e4723d34248
Complain only about non-identical redefinitions of macros.
author | David A. Holland |
---|---|
date | Mon, 10 Jun 2013 21:34:59 -0400 |
parents | bbbf71859a21 |
children | c91dc1315745 |
comparison
equal
deleted
inserted
replaced
83:3e505c16b0b0 | 84:7e4723d34248 |
---|---|
443 | 443 |
444 oldm = macrotable_find(m->name, false); | 444 oldm = macrotable_find(m->name, false); |
445 if (oldm != NULL) { | 445 if (oldm != NULL) { |
446 ok = macro_eq(m, oldm); | 446 ok = macro_eq(m, oldm); |
447 if (ok) { | 447 if (ok) { |
448 /* in traditional cpp this is silent */ | |
449 //complain(&m->defplace, | |
450 // "Warning: redefinition of %s", m->name); | |
451 //complain(&oldm->defplace, | |
452 // "Previous definition was here"); | |
453 //if (mode.werror) { | |
454 // complain_fail(); | |
455 //} | |
456 } else { | |
448 complain(&m->defplace, | 457 complain(&m->defplace, |
449 "Warning: redefinition of %s", m->name); | 458 "Warning: non-identical redefinition of %s", |
459 m->name); | |
460 complain(&oldm->defplace, | |
461 "Previous definition was here"); | |
462 /* in traditional cpp this is not fatal */ | |
450 if (mode.werror) { | 463 if (mode.werror) { |
451 complain_fail(); | 464 complain_fail(); |
452 } | 465 } |
453 } else { | 466 } |
454 complain(&m->defplace, | |
455 "Redefinition of %s is not identical", | |
456 m->name); | |
457 complain_fail(); | |
458 } | |
459 complain(&oldm->defplace, "Previous definition was here"); | |
460 macro_destroy(m); | 467 macro_destroy(m); |
461 return; | 468 return; |
462 } | 469 } |
463 macrotable_add(m); | 470 macrotable_add(m); |
464 } | 471 } |