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)
bool has_warning_spec (const_tree t)
unsigned get_warning_spec (const_tree t)
void put_warning_spec (tree t, unsigned bits)

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 copy_warning().

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 copy_warning().

◆ copy_warning() [3/5]

template<class ToType, class FromType>
void copy_warning ( ToType to,
FromType from )
Copy the warning disposition mapping between an expression and/or a statement.

References gcc_assert, gcc_checking_assert, get_location(), get_no_warning_bit(), get_nowarn_spec(), nowarn_map, RESERVED_LOCATION_P, and set_no_warning_bit().

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

◆ copy_warning() [4/5]

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

References copy_warning().

◆ copy_warning() [5/5]

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

References copy_warning().

◆ get_location() [1/2]

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

References gimple_location().

◆ get_location() [2/2]

location_t get_location ( const_tree expr)
inlinestatic

◆ get_no_warning_bit() [1/2]

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

◆ get_no_warning_bit() [2/2]

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-2025 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(), has_warning_spec(), warning_suppressed_p(), and warning_suppressed_p().

◆ get_nowarn_spec() [1/2]

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

References get_location(), get_no_warning_bit(), nowarn_map, NULL, and RESERVED_LOCATION_P.

◆ get_nowarn_spec() [2/2]

nowarn_spec_t * get_nowarn_spec ( const_tree expr)
static
Return the no-warning bitmap for decl/expression EXPR.

References get_location(), get_no_warning_bit(), nowarn_map, NULL, and RESERVED_LOCATION_P.

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

◆ get_warning_spec()

unsigned get_warning_spec ( const_tree t)
Retrieve warning dispostion bitmap for tree streaming.

References get_nowarn_spec().

◆ has_warning_spec()

bool has_warning_spec ( const_tree t)
Whether the tree might have a warning spec.

References get_location(), get_no_warning_bit(), and RESERVED_LOCATION_P.

◆ put_warning_spec()

void put_warning_spec ( tree t,
unsigned bits )
Write warning disposition bitmap for streamed-in tree.

References get_location(), and put_warning_spec_at().

◆ set_no_warning_bit() [1/2]

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

References value.

◆ set_no_warning_bit() [2/2]

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

References 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(), 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(), find_tail_calls(), 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(), suitable_for_tail_call_opt_p(), 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(), 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(), and get_nowarn_spec().