GCC Middle and Back End API Reference
diagnostic.h File Reference

Go to the source code of this file.

Data Structures

struct  diagnostic_info
struct  diagnostic_classification_change_t
struct  diagnostic_context

Typedefs

typedef struct diagnostic_info diagnostic_info
typedef struct
diagnostic_classification_change_t 
diagnostic_classification_change_t
typedef void(* diagnostic_starter_fn )(diagnostic_context *, diagnostic_info *)
typedef diagnostic_starter_fn diagnostic_finalizer_fn

Functions

static void diagnostic_inhibit_notes ()
void diagnostic_initialize (diagnostic_context *, int)
void diagnostic_finish (diagnostic_context *)
void diagnostic_report_current_module (diagnostic_context *, location_t)
void diagnostic_show_locus (diagnostic_context *, const diagnostic_info *)
diagnostic_t diagnostic_classify_diagnostic (diagnostic_context *, int, diagnostic_t, location_t)
void diagnostic_push_diagnostics (diagnostic_context *, location_t)
void diagnostic_pop_diagnostics (diagnostic_context *, location_t)
bool diagnostic_report_diagnostic (diagnostic_context *, diagnostic_info *)
void diagnostic_set_info (diagnostic_info *, const char *, va_list *, location_t, diagnostic_t) ATTRIBUTE_GCC_DIAG(2
void void diagnostic_set_info_translated (diagnostic_info *, const char *, va_list *, location_t, diagnostic_t) ATTRIBUTE_GCC_DIAG(2
void void void diagnostic_append_note (diagnostic_context *, location_t, const char *,...) ATTRIBUTE_GCC_DIAG(3
void void void char * diagnostic_build_prefix (diagnostic_context *, const diagnostic_info *)
void default_diagnostic_starter (diagnostic_context *, diagnostic_info *)
void default_diagnostic_finalizer (diagnostic_context *, diagnostic_info *)
void diagnostic_set_caret_max_width (diagnostic_context *context, int value)
char * file_name_as_prefix (diagnostic_context *, const char *)

Variables

diagnostic_contextglobal_dc

Typedef Documentation

   Each time a diagnostic's classification is changed with a pragma,
   we record the change and the location of the change in an array of
   these structs.  
   A diagnostic is described by the MESSAGE to send, the FILE and LINE of
   its context and its KIND (ice, error, warning, note, ...)  See complete
   list in diagnostic.def.  
typedef void(* diagnostic_starter_fn)(diagnostic_context *, diagnostic_info *)
    Forward declarations.  

Function Documentation

void void void diagnostic_append_note ( diagnostic_context ,
location_t  ,
const char *  ,
  ... 
)
void void void char* diagnostic_build_prefix ( diagnostic_context context,
const diagnostic_info diagnostic 
)
   Return a malloc'd string describing a location.  The caller is
   responsible for freeing the memory.  

References colorize_start(), colorize_stop(), and diagnostic_info::kind.

Referenced by default_tree_diagnostic_starter(), and trim_filename().

diagnostic_t diagnostic_classify_diagnostic ( diagnostic_context context,
int  option_index,
diagnostic_t  new_kind,
location_t  where 
)
   Force diagnostics controlled by OPTIDX to be kind KIND.  
   Interface to specify diagnostic kind overrides.  Returns the
   previous setting, or DK_UNSPECIFIED if the parameters are out of
   range.  If OPTION_INDEX is zero, the new setting is for all the
   diagnostics.  
     Handle pragmas separately, since we need to keep track of *where*
     the pragmas were.  
void diagnostic_finish ( diagnostic_context )
static void diagnostic_inhibit_notes ( )
inlinestatic

References global_dc.

void diagnostic_initialize ( diagnostic_context ,
int   
)
   Diagnostic related functions.  
void diagnostic_pop_diagnostics ( diagnostic_context ,
location_t   
)
void diagnostic_push_diagnostics ( diagnostic_context ,
location_t   
)
void diagnostic_report_current_module ( diagnostic_context ,
location_t   
)
bool diagnostic_report_diagnostic ( diagnostic_context context,
diagnostic_info diagnostic 
)
   Report a diagnostic message (an error or a warning) as specified by
   DC.  This function is *the* subroutine in terms of which front-ends
   should implement their specific diagnostic handling modules.  The
   front-end independent format specifiers are exactly those described
   in the documentation of output_format.
   Return true if a diagnostic was printed, false otherwise.  
     Give preference to being able to inhibit warnings, before they
     get reclassified to something else.  
         We do this to avoid giving the message for -pedantic-errors.  
         If we're reporting an ICE in the middle of some other error,
         try to flush out the previous error, then let this one
         through.  Don't do this more than once.  
     If the user requested that warnings be treated as errors, so be
     it.  Note that we do this before the next block so that
     individual warnings can be overridden back to warnings with
     -Wno-error=*.  
         This tests if the user provided the appropriate -Wfoo or
         -Wno-foo option.  
         This tests for #pragma diagnostic changes.  
             FIXME: Stupid search.  Optimize later. 
                     The option 0 is for all the diagnostics.  
         This tests if the user provided the appropriate -Werror=foo
         option.  
         This allows for future extensions, like temporarily disabling
         warnings for ranges of source code.  
         When not checking, ICEs are converted to fatal errors when an
         error has already occurred.  This is counteracted by
         abort_on_error.  

References diagnostic_info::kind.

void diagnostic_set_caret_max_width ( diagnostic_context context,
int  value 
)
void diagnostic_set_info ( diagnostic_info ,
const char *  ,
va_list *  ,
location_t  ,
diagnostic_t   
)
void void diagnostic_set_info_translated ( diagnostic_info ,
const char *  ,
va_list *  ,
location_t  ,
diagnostic_t   
)
void diagnostic_show_locus ( diagnostic_context context,
const diagnostic_info diagnostic 
)
   Print the physical source line corresponding to the location of
   this diagnostics, and a caret indicating the precise column.  
     pp_printf does not implement %*c.  

Referenced by trim_filename().

char* file_name_as_prefix ( diagnostic_context ,
const char *   
)
   Pure text formatting support functions.  

Variable Documentation

diagnostic_context* global_dc
   This diagnostic_context is used by front-ends that directly output
   diagnostic messages without going through `error', `warning',
   and similar functions.  

Referenced by diagnostic_inhibit_notes(), display_help(), get_src_pwd(), main(), and verbatim().