goto invalid_suffix;
op.unsignedp = sufftab[i].u;
- if (CPP_WTRADITIONAL (pfile) && sufftab[i].u)
+ if (CPP_WTRADITIONAL (pfile)
+ && sufftab[i].u
+ && ! cpp_sys_macro_p (pfile))
cpp_warning (pfile, "traditional C rejects the `U' suffix");
if (sufftab[i].l == 2 && CPP_OPTION (pfile, pedantic)
&& ! CPP_OPTION (pfile, c99))
return parse_defined (pfile);
}
- /* Controlling #if expressions cannot contain identifiers (they
- could become macros in the future). */
- pfile->mi_state = MI_FAILED;
-
- op.op = CPP_INT;
- op.unsignedp = 0;
- op.value = 0;
+ else if (CPP_OPTION (pfile, cplusplus)
+ && (token->val.node == pfile->spec_nodes.n_true
+ || token->val.node == pfile->spec_nodes.n_false))
+ {
+ op.op = CPP_INT;
+ op.unsignedp = 0;
+ op.value = (token->val.node == pfile->spec_nodes.n_true);
+
+ /* Warn about use of true or false in #if when pedantic
+ and stdbool.h has not been included. */
+ if (CPP_PEDANTIC (pfile)
+ && ! cpp_defined (pfile, DSC("__bool_true_false_are_defined")))
+ cpp_pedwarn (pfile, "ISO C++ does not permit \"%s\" in #if",
+ token->val.node->name);
+ return op;
+ }
+ else
+ {
+ /* Controlling #if expressions cannot contain identifiers (they
+ could become macros in the future). */
+ pfile->mi_state = MI_FAILED;
- if (CPP_OPTION (pfile, warn_undef) && !skip_evaluation)
- cpp_warning (pfile, "\"%s\" is not defined", token->val.node->name);
+ op.op = CPP_INT;
+ op.unsignedp = 0;
+ op.value = 0;
- return op;
+ if (CPP_OPTION (pfile, warn_undef) && !skip_evaluation)
+ cpp_warning (pfile, "\"%s\" is not defined", token->val.node->name);
+ return op;
+ }
case CPP_HASH:
{
/* Fall through. */
default:
- if ((token->type > CPP_EQ && token->type < CPP_PLUS_EQ)
+ if (((int) token->type > (int) CPP_EQ
+ && (int) token->type < (int) CPP_PLUS_EQ)
|| token->type == CPP_EOF)
{
op.op = token->type;