/* Print an error at the location of the previously lexed token. */ void cpp_error (cpp_reader * pfile, int level, const char *msgid, ...) { source_location src_loc; va_list ap; va_start (ap, msgid); if (CPP_OPTION (pfile, traditional)) { if (pfile->state.in_directive) src_loc = pfile->directive_line; else src_loc = pfile->line_table->highest_line; } else { src_loc = pfile->cur_token[-1].src_loc; } if (_cpp_begin_message (pfile, level, src_loc, 0)) v_message (msgid, ap); va_end (ap); }
/* Print an error at a specific location. */ void cpp_error_with_line (cpp_reader *pfile, int level, source_location src_loc, unsigned int column, const char *msgid, ...) { va_list ap; va_start (ap, msgid); if (_cpp_begin_message (pfile, level, src_loc, column)) v_message (msgid, ap); va_end (ap); }
/* Print an error at the location of the previously lexed token. */ void cpp_error (cpp_reader * pfile, int level, const char *msgid, ...) { source_location src_loc; va_list ap; va_start (ap, msgid); if (CPP_OPTION (pfile, client_diagnostic)) pfile->cb.error (pfile, level, _(msgid), &ap); else { if (CPP_OPTION (pfile, traditional)) { if (pfile->state.in_directive) src_loc = pfile->directive_line; else src_loc = pfile->line_table->highest_line; } /* We don't want to refer to a token before the beginning of the current run -- that is invalid. */ else if (pfile->cur_token == pfile->cur_run->base) { if (pfile->cur_run->prev != NULL) src_loc = pfile->cur_run->prev->limit->src_loc; else src_loc = 0; } /* We don't want to refer to a token before the beginning of the current run -- that is invalid. */ else if (pfile->cur_token == pfile->cur_run->base) { if (pfile->cur_run->prev != NULL) src_loc = pfile->cur_run->prev->limit->src_loc; else src_loc = 0; } else { src_loc = pfile->cur_token[-1].src_loc; } if (_cpp_begin_message (pfile, level, src_loc, 0)) v_message (msgid, ap); } va_end (ap); }
/* Print an error at the location of the previously lexed token. */ void cpp_error (cpp_reader * pfile, int level, const char *msgid, ...) { source_location src_loc; va_list ap; va_start (ap, msgid); if (CPP_OPTION (pfile, client_diagnostic)) pfile->cb.error (pfile, level, _(msgid), &ap); else { if (CPP_OPTION (pfile, traditional)) { if (pfile->state.in_directive) src_loc = pfile->directive_line; else src_loc = pfile->line_table->highest_line; } else { /* Find actual previous token. */ cpp_token *t; if (pfile->cur_token != pfile->cur_run->base) t = pfile->cur_token - 1; else { if (pfile->cur_run->prev != NULL) t = pfile->cur_run->prev->limit; else t = NULL; } /* Retrieve corresponding source location, unless we failed. */ src_loc = t ? t->src_loc : 0; } if (_cpp_begin_message (pfile, level, src_loc, 0)) v_message (msgid, ap); } va_end (ap); }
/* Print an error at the location of the previously lexed token. */ void cpp_error (cpp_reader * pfile, int level, const char *msgid, ...) { source_location src_loc; va_list ap; va_start (ap, msgid); if (CPP_OPTION (pfile, client_diagnostic)) { /* Versions up to 4.0.2 used cpplib's notion of pedantic_errors rather than the front end's, so preserve this for the 4.0 branch. */ if (level == CPP_DL_PEDWARN) level = (CPP_OPTION (pfile, pedantic_errors) ? CPP_DL_ERROR : CPP_DL_WARNING); pfile->cb.error (pfile, level, _(msgid), &ap); } else { if (CPP_OPTION (pfile, traditional)) { if (pfile->state.in_directive) src_loc = pfile->directive_line; else src_loc = pfile->line_table->highest_line; } else { src_loc = pfile->cur_token[-1].src_loc; } if (_cpp_begin_message (pfile, level, src_loc, 0)) v_message (msgid, ap); } va_end (ap); }