+/* Prepare to handle the directive in pfile->directive. */
+static void
+prepare_directive_trad (cpp_reader *pfile)
+{
+ if (pfile->directive != &dtable[T_DEFINE])
+ {
+ bool no_expand = (pfile->directive
+ && ! (pfile->directive->flags & EXPAND));
+ bool was_skipping = pfile->state.skipping;
+
+ pfile->state.in_expression = (pfile->directive == &dtable[T_IF]
+ || pfile->directive == &dtable[T_ELIF]);
+ if (pfile->state.in_expression)
+ pfile->state.skipping = false;
+
+ if (no_expand)
+ pfile->state.prevent_expansion++;
+ _cpp_scan_out_logical_line (pfile, NULL);
+ if (no_expand)
+ pfile->state.prevent_expansion--;
+
+ pfile->state.skipping = was_skipping;
+ _cpp_overlay_buffer (pfile, pfile->out.base,
+ pfile->out.cur - pfile->out.base);
+ }
+
+ /* Stop ISO C from expanding anything. */
+ pfile->state.prevent_expansion++;
+}
+
+/* Output diagnostics for a directive DIR. INDENTED is nonzero if
+ the '#' was indented. */
+static void
+directive_diagnostics (cpp_reader *pfile, const directive *dir, int indented)
+{
+ /* Issue -pedantic warnings for extensions. */
+ if (CPP_PEDANTIC (pfile)
+ && ! pfile->state.skipping
+ && dir->origin == EXTENSION)
+ cpp_error (pfile, CPP_DL_PEDWARN, "#%s is a GCC extension", dir->name);
+
+ /* Traditionally, a directive is ignored unless its # is in
+ column 1. Therefore in code intended to work with K+R
+ compilers, directives added by C89 must have their #
+ indented, and directives present in traditional C must not.
+ This is true even of directives in skipped conditional
+ blocks. #elif cannot be used at all. */
+ if (CPP_WTRADITIONAL (pfile))
+ {
+ if (dir == &dtable[T_ELIF])
+ cpp_error (pfile, CPP_DL_WARNING,
+ "suggest not using #elif in traditional C");
+ else if (indented && dir->origin == KANDR)
+ cpp_error (pfile, CPP_DL_WARNING,
+ "traditional C ignores #%s with the # indented",
+ dir->name);
+ else if (!indented && dir->origin != KANDR)
+ cpp_error (pfile, CPP_DL_WARNING,
+ "suggest hiding #%s from traditional C with an indented #",
+ dir->name);
+ }
+}
+
+/* Check if we have a known directive. INDENTED is nonzero if the
+ '#' of the directive was indented. This function is in this file
+ to save unnecessarily exporting dtable etc. to cpplex.c. Returns
+ nonzero if the line of tokens has been handled, zero if we should
+ continue processing the line. */