Clang Flag: -Wdeprecated / -Wno-deprecated

From emmtrix Wiki
Jump to navigation Jump to search
The Clang compiler flags -Wdeprecated and -Wno-deprecated pertain to the emission of warnings related to deprecated features in source code. Deprecated features can include types, functions, variables, and more, that are marked as deprecated because they may be removed in future versions of a software or because their use is discouraged for other reasons. The use of these flags helps developers maintain modern and clean codebases by encouraging the migration away from deprecated features.

-Wdeprecated is used to enable warnings about the usage of deprecated features. For some warnings, this flag is not active by default and needs to be explicitly enabled to warn about specific deprecated features. These include deprecated copying behaviors due to user-declared or user-provided copy constructors or destructors, the use of dynamic exception specifications, certain deprecated literal operators, and some specific cases of static data member initialization.

-Wno-deprecated inversely suppresses warnings about the use of deprecated features that are enabled by default. This is useful in scenarios where maintaining backward compatibility or dealing with legacy codebases necessitates the use of deprecated features, or when the warnings are deemed not critical for the specific context of the project.

Both flags are valuable tools in a developer’s arsenal for writing up-to-date, standard-compliant code, and managing the transition away from deprecated language or library features with minimal disruption.

 
AI Generated

Supergroups

Subroups

Warnings/Remarks

Default Active (Deactivate with -Wno-deprecated)

warn_O4_is_O3 warning: -O4 is equivalent to -O3
warn_access_decl_deprecated warning: access declarations are deprecated; use using declarations instead
warn_drv_deprecated_arg warning: argument 'A' is deprecated, use 'B' instead
warn_drv_treating_input_as_cxx warning: treating 'A' input as 'B' when in C++ mode, this behavior is deprecated
warn_omp_depend_in_ordered_deprecated warning: 'depend' clause for 'ordered' is deprecated; use 'doacross' instead
warn_omp_minus_in_reduction_deprecated warning: minus(-) operator for reductions is deprecated; use + or user defined reduction instead
warn_option_invalid_ocl_version warning: A does not support the option 'B'
warn_vector_long_decl_spec_combination warning: Use of 'long' with '__vector' is deprecated
warn_arith_conv_mixed_anon_enum_types_cxx20
warning:
arithmetic between
bitwise operation between
comparison of
conditional expression between
compound assignment of
different enumeration types
(B and C)
 
is deprecated

warn_depr_array_comparison warning: comparison between two arrays is deprecated; to compare array addresses, use unary '+' to decay operands to pointers
warn_deprecated_noreturn_spelling warning: the '_Noreturn' attribute spelling is deprecated in C2x; use 'noreturn' instead
warn_type_attribute_deprecated_on_decl warning: applying attribute A to a declaration is deprecated; apply it to the type instead
warn_vector_mode_deprecated warning: specifying vector types with the 'mode' attribute is deprecated; use the 'vector_size' attribute instead
warn_deprecated_comma_subscript warning: top-level comma expression in array subscript is deprecated in C++20 and unsupported in C++23
warn_atl_uuid_deprecated warning: specifying 'uuid' as an ATL attribute is deprecated; use __declspec instead
warn_cstyle_param warning: use of C-style parameters in Objective-C method declarations is deprecated
warn_deprecated warning: A is deprecated
warn_deprecated_fwdclass_message warning: A may be deprecated because the receiver type is unknown
warn_deprecated_message warning: A is deprecated: B
warn_property_method_deprecated warning: property access is using A method which is deprecated
warn_comparison_mixed_enum_types_cxx20
warning:
arithmetic between
bitwise operation between
comparison of
conditional expression between
compound assignment of
different enumeration types
(B and C)
 
is deprecated

warn_conditional_mixed_enum_types_cxx20
warning:
arithmetic between
bitwise operation between
comparison of
conditional expression between
compound assignment of
different enumeration types
(B and C)
 
is deprecated

warn_arith_conv_mixed_enum_types_cxx20
warning:
arithmetic between
bitwise operation between
comparison of
conditional expression between
compound assignment of
different enumeration types
(B and C)
 
is deprecated

warn_arith_conv_enum_float_cxx20
warning:
arithmetic between
bitwise operation between
comparison of
conditional expression between
compound assignment of
floating-point
enumeration
type C
with
from
and
enumeration
floating-point
type D is deprecated

warn_deprecated_builtin warning: builtin A is deprecated; use B instead
warn_increment_bool warning: incrementing expression of type bool is deprecated and incompatible with C++17
warn_pragma_deprecated_macro_use
warning: macro A has been marked as deprecated
 
: C

warn_deprecated_register warning: 'register' storage class specifier is deprecated and incompatible with C++17
warn_deprecated_this_capture warning: implicit capture of 'this' with a capture default of '=' is deprecated
warn_ext_int_deprecated warning: '_ExtInt' is deprecated; use '_BitInt' instead
warn_deprecated_increment_decrement_volatile
warning:
decrement
increment
of object of volatile-qualified type B is deprecated

warn_deprecated_simple_assign_volatile warning: use of result of assignment to object of volatile-qualified type A is deprecated
warn_deprecated_volatile_param warning: volatile-qualified parameter type A is deprecated
warn_deprecated_volatile_return warning: volatile-qualified return type A is deprecated
warn_deprecated_volatile_structured_binding warning: volatile qualifier in structured binding declaration is deprecated
warn_deprecated_string_literal_conversion warning: conversion from string literal to A is deprecated

Default Inactive (Activate with -Wdeprecated)

warn_deprecated_copy
warning: definition of implicit copy
constructor
assignment operator
for A is deprecated because it has a user-declared copy
assignment operator
constructor

warn_deprecated_copy_with_user_provided_copy
warning: definition of implicit copy
constructor
assignment operator
for A is deprecated because it has a user-provided copy
assignment operator
constructor

warn_deprecated_copy_with_dtor
warning: definition of implicit copy
constructor
assignment operator
for A is deprecated because it has a user-declared destructor

warn_deprecated_copy_with_user_provided_dtor
warning: definition of implicit copy
constructor
assignment operator
for A is deprecated because it has a user-provided destructor

warn_exception_spec_deprecated warning: dynamic exception specifications are deprecated
warn_deprecated_literal_operator_id warning: identifier A preceded by whitespace in a literal operator declaration is deprecated
warn_deprecated_redundant_constexpr_static_def warning: out-of-line definition of constexpr static data member is redundant in C++17 and is deprecated