GCC Middle and Back End API Reference
warning-control.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "bitmap.h"
#include "tree.h"
#include "gimple.h"
#include "cgraph.h"
#include "hash-map.h"
#include "diagnostic-spec.h"
Include dependency graph for warning-control.cc:

Functions

static bool get_no_warning_bit (const_tree expr)
 
static bool get_no_warning_bit (const gimple *stmt)
 
static void set_no_warning_bit (tree expr, bool value)
 
static void set_no_warning_bit (gimple *stmt, bool value)
 
static location_t get_location (const_tree expr)
 
static location_t get_location (const gimple *stmt)
 
static nowarn_spec_tget_nowarn_spec (const_tree expr)
 
static nowarn_spec_tget_nowarn_spec (const gimple *stmt)
 
bool warning_suppressed_p (const_tree expr, opt_code opt)
 
bool warning_suppressed_p (const gimple *stmt, opt_code opt)
 
void suppress_warning (tree expr, opt_code opt, bool supp)
 
void suppress_warning (gimple *stmt, opt_code opt, bool supp)
 
template<class ToType , class FromType >
void copy_warning (ToType to, FromType from)
 
void copy_warning (tree to, const_tree from)
 
void copy_warning (tree to, const gimple *from)
 
void copy_warning (gimple *to, const_tree from)
 
void copy_warning (gimple *to, const gimple *from)
 

Function Documentation

◆ copy_warning() [1/5]

void copy_warning ( gimple * to,
const gimple * from )
Copy the warning disposition mapping from one statement to another.   

References ggc_alloc().

Referenced by gimple_set_location().

◆ copy_warning() [2/5]

void copy_warning ( gimple * to,
const_tree from )
Copy the warning disposition mapping from an expression to a statement.   

References ggc_alloc().

◆ copy_warning() [3/5]

◆ copy_warning() [4/5]

void copy_warning ( tree to,
const gimple * from )
Copy the warning disposition mapping from a statement to an expression.   

References ggc_alloc().

◆ copy_warning() [5/5]

void copy_warning ( tree to,
const_tree from )
Copy the warning disposition mapping from one expression to another.   

References ggc_alloc().

◆ get_location() [1/2]

static location_t get_location ( const gimple * stmt)
inlinestatic
Return STMT location (may be 'UNKNOWN_LOCATION').   

References gimple_location().

◆ get_location() [2/2]

static location_t get_location ( const_tree expr)
inlinestatic
Return EXPR location or 'UNKNOWN_LOCATION'.   

References DECL_P, DECL_SOURCE_LOCATION, EXPR_LOCATION, EXPR_P, and UNKNOWN_LOCATION.

Referenced by copy_warning(), get_nowarn_spec(), get_nowarn_spec(), suppress_warning(), and suppress_warning().

◆ get_no_warning_bit() [1/2]

static bool get_no_warning_bit ( const gimple * stmt)
inlinestatic
Return the no-warning bit for statement STMT.   

References gimple::no_warning.

◆ get_no_warning_bit() [2/2]

static bool get_no_warning_bit ( const_tree expr)
inlinestatic
Functions to enable and disable individual warnings on an expression
and statement basis.

Copyright (C) 2021-2024 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   
Return the no-warning bit for EXPR.   

Referenced by copy_warning(), get_nowarn_spec(), get_nowarn_spec(), warning_suppressed_p(), and warning_suppressed_p().

◆ get_nowarn_spec() [1/2]

static nowarn_spec_t * get_nowarn_spec ( const gimple * stmt)
static
Return the no-warning bitmap for statement STMT.   

References hash_map< KeyId, Value, Traits >::get(), get_location(), get_no_warning_bit(), ggc_alloc(), nowarn_map, NULL, and RESERVED_LOCATION_P.

◆ get_nowarn_spec() [2/2]

static nowarn_spec_t * get_nowarn_spec ( const_tree expr)
static

◆ set_no_warning_bit() [1/2]

static void set_no_warning_bit ( gimple * stmt,
bool value )
inlinestatic
Set the no-warning bit for statement STMT to VALUE.   

References gimple::no_warning.

◆ set_no_warning_bit() [2/2]

static void set_no_warning_bit ( tree expr,
bool value )
inlinestatic
Set the no-warning bit for EXPR to VALUE.   

Referenced by copy_warning(), suppress_warning(), and suppress_warning().

◆ suppress_warning() [1/2]

void suppress_warning ( gimple * stmt,
opt_code opt,
bool supp )
Enable, or by default disable, a warning for the statement STMT.
The wildcard OPT of -1 controls all warnings.   

References get_location(), ggc_alloc(), no_warning, RESERVED_LOCATION_P, set_no_warning_bit(), and suppress_warning_at().

Referenced by c_strlen(), check_access(), array_bounds_checker::check_addr_expr(), array_bounds_checker::check_array_bounds(), array_bounds_checker::check_array_ref(), check_bounds_or_overlap(), array_bounds_checker::check_mem_ref(), clear_padding_flush(), cond_store_replacement(), create_access_replacement(), create_one_component_var(), declare_return_variable(), do_mpfr_remquo(), execute_sm(), execute_update_addresses_taken(), expand_call_inline(), expand_omp_for_generic(), expand_omp_taskloop_for_outer(), fold_builtin_frexp(), fold_builtin_modf(), fold_builtin_varargs(), fold_unary_loc(), generate_subtree_copies(), gimple_fold_builtin_stpcpy(), gimple_fold_builtin_strcpy(), gimple_fold_builtin_strncat(), gimple_lower_bitint(), gimple_push_cleanup(), gimplify_modify_expr_complex_part(), gimplify_return_expr(), strlen_pass::handle_builtin_strcat(), strlen_pass::handle_builtin_strcpy(), strlen_pass::handle_builtin_stxncpy_strncat(), handle_printf_call(), lower_lastprivate_clauses(), lower_omp_target(), lower_rec_input_clauses(), lower_send_clauses(), maybe_warn_for_bound(), maybe_warn_nonstring_arg(), strlen_pass::maybe_warn_overflow(), maybe_warn_read_write_only(), set_no_uninit_warning(), test_for_singularity(), vectorizable_operation(), warn_for_access(), warn_string_no_nul(), and warn_uninit().

◆ suppress_warning() [2/2]

void suppress_warning ( tree expr,
opt_code opt,
bool supp )
Enable, or by default disable, a warning for the expression.
The wildcard OPT of -1 controls all warnings.   

References get_location(), ggc_alloc(), no_warning, RESERVED_LOCATION_P, set_no_warning_bit(), and suppress_warning_at().

◆ warning_suppressed_p() [1/2]

◆ warning_suppressed_p() [2/2]

bool warning_suppressed_p ( const_tree expr,
opt_code opt )
Return true if warning OPT is suppressed for decl/expression EXPR.
By default tests the disposition for any warning.   

References gcc_assert, get_no_warning_bit(), get_nowarn_spec(), and ggc_alloc().