Hi Jakub,

> On 13 Oct 2025, at 10:06, Jakub Jelinek <[email protected]> wrote:
> 
> On Mon, Oct 13, 2025 at 07:07:01AM +0100, Iain Sandoe wrote:
>> Tested on x86_64-darwin24, pushed to trunk, thanks
>> Iain
>> 
>> --- 8< ---
>> 
>> r16-4373 altered headers so that Wignored-attributes was named in
>> a diagnostic push.  This causes several Objective-C++ tests to fail
>> since the atomicity.h header is included there.
>> 
>> Since Objective-C/C++ are intended to be supersets of the base
>> language, there is no specific reason to exclude this warning there.
>> 
>> gcc/c-family/ChangeLog:
>> 
>> * c.opt: Enable Wignored-attributes for Objective-C and
>> Objective-C++.
>> 
>> Signed-off-by: Iain Sandoe <[email protected]>
> 
> I wrote a more complete version of this patch, here is it rebased
> on top of your patch.

you beat me to it … 

> I see no reason for any of these options to be C C++ only rather than
> C ObjC C++ ObjC++, or in some cases C++ only rather than C++ ObjC++.
> The only cases where I think limiting to C only is desirable are
> fgimple
> C Var(flag_gimple) Init(0)
> Enable parsing GIMPLE.
> where I think we don't want to support ObjC for GIMPLE FE, and
> lang-asm
> C Undocumented RejectDriver

makes sense.

> For everything else I believe people adding those options just didn't
> think of ObjC or ObjC++.

For some of the newer C++ features (e.g. coroutines and contracts) I don’t
think that there’s been too much consideration of how they interact with
Objective-C++ (it’s mostly outside the remit of WG21, although there are
Apple folks involved  - so they’d have a chance to raise concerns).

So I think it’s OK to enable them for now - I have time to pull them later in
GCC-16 if they really are not workable (plus the only ‘definition’ about the
correct behaviour is ‘what clang does’) so I need to try and evaluate that.

> Bootstrapped on x86_64-linux and i686-linux, ok for trunk?

Yes, thanks (I did a quick run on x86_64-darwin24, with no new issues reported)

Iain
> 
> 2025-10-13  Jakub Jelinek  <[email protected]>
> 
> * c.opt (Wflex-array-member-not-at-end, Wignored-qualifiers,
> Wopenacc-parallelism, Wstrict-flex-arrays, Wsync-nand,
> fstrict-flex-arrays, fstrict-flex-arrays=): Enable also for ObjC and
> ObjC++ next to C and C++.
> (Wmisleading-indentation, Wopenmp-simd): Likewise.  Also change
> LangEnabledBy from just C C++ to C ObjC C++ ObjC++.
> (Wplacement-new, Wplacement-new=, fcontract-assumption-mode=,
> fcontract-build-level=, fcontract-strict-declarations=,
> fcontract-mode=, fcontract-continuation-mode=, fcontract-role=,
> fcontract-semantic=, fcoroutines, flang-info-include-translate,
> flang-info-include-translate-not, flang-info-include-translate=,
> flang-info-module-cmi, flang-info-module-cmi=): Enable also
> for ObjC++ next to C++.
> 
> --- gcc/c-family/c.opt.jj 2025-10-04 09:42:48.873647765 +0200
> +++ gcc/c-family/c.opt 2025-10-13 09:34:40.747617261 +0200
> @@ -774,7 +774,7 @@ C++ ObjC++ Var(warn_extra_semi) Init(-1)
> Warn about semicolon after in-class function definition.
> 
> Wflex-array-member-not-at-end
> -C C++ Var(warn_flex_array_member_not_at_end) Warning
> +C ObjC C++ ObjC++ Var(warn_flex_array_member_not_at_end) Warning
> Warn when a structure containing a C99 flexible array member as the last
> field is not at the end of another structure.
> 
> @@ -866,11 +866,11 @@ C ObjC C++ ObjC++ Var(warn_if_not_aligne
> Warn when the field in a struct is not aligned.
> 
> Wignored-qualifiers
> -C C++ Var(warn_ignored_qualifiers) Warning EnabledBy(Wextra)
> +C ObjC C++ ObjC++ Var(warn_ignored_qualifiers) Warning EnabledBy(Wextra)
> Warn whenever type qualifiers are ignored.
> 
> Wignored-attributes
> C ObjC C++ ObjC++ Var(warn_ignored_attributes) Init(1) Warning
> Warn whenever attributes are ignored.
> 
> Wimplicit
> @@ -1013,7 +1013,7 @@ C ObjC C++ ObjC++ Var(warn_memset_transp
> Warn about suspicious calls to memset where the third argument is constant 
> literal zero and the second is not.
> 
> Wmisleading-indentation
> -C C++ Common Var(warn_misleading_indentation) Warning LangEnabledBy(C 
> C++,Wall)
> +C ObjC C++ ObjC++ Common Var(warn_misleading_indentation) Warning 
> LangEnabledBy(C ObjC C++ ObjC++,Wall)
> Warn when the indentation of the code does not reflect the block structure.
> 
> Wmismatched-dealloc
> @@ -1187,7 +1187,7 @@ C ObjC Var(warn_old_style_definition) In
> Warn if an old-style parameter definition is used.
> 
> Wopenacc-parallelism
> -C C++ Var(warn_openacc_parallelism) Warning
> +C ObjC C++ ObjC++ Var(warn_openacc_parallelism) Warning
> Warn about potentially suboptimal choices related to OpenACC parallelism.
> 
> Wopenmp
> @@ -1195,7 +1195,7 @@ C ObjC C++ ObjC++ Warning Var(warn_openm
> Warn about suspicious OpenMP code.
> 
> Wopenmp-simd
> -C C++ Var(warn_openmp_simd) Warning LangEnabledBy(C C++,Wall)
> +C ObjC C++ ObjC++ Var(warn_openmp_simd) Warning LangEnabledBy(C ObjC C++ 
> ObjC++,Wall)
> Warn if a simd directive is overridden by the vectorizer cost model.
> 
> Woverlength-strings
> @@ -1243,11 +1243,11 @@ C++ ObjC++ Var(warn_pessimizing_move) Wa
> Warn about calling std::move on a local object in a return statement 
> preventing copy elision.
> 
> Wplacement-new
> -C++ Warning Alias(Wplacement-new=, 1, 0)
> +C++ ObjC++ Warning Alias(Wplacement-new=, 1, 0)
> Warn for placement new expressions with undefined behavior.
> 
> Wplacement-new=
> -C++ Joined RejectNegative UInteger Var(warn_placement_new) Init(-1) Warning 
> IntegerRange(0, 2)
> +C++ ObjC++ Joined RejectNegative UInteger Var(warn_placement_new) Init(-1) 
> Warning IntegerRange(0, 2)
> Warn for placement new expressions with undefined behavior.
> 
> Wpmf-conversions
> @@ -1417,7 +1417,7 @@ C ObjC C++ ObjC++ LangEnabledBy(C ObjC C
> ;
> 
> Wstrict-flex-arrays
> -C C++ Var(warn_strict_flex_arrays) Warning
> +C ObjC C++ ObjC++ Var(warn_strict_flex_arrays) Warning
> Warn about improper usages of flexible array members
> according to the level of -fstrict-flex-arrays.
> 
> @@ -1495,7 +1495,7 @@ C ObjC C++ ObjC++ Var(warn_switch_outsid
> Warn about switch values that are outside of the switch's type range.
> 
> Wsync-nand
> -C C++ Var(warn_sync_nand) Init(1) Warning
> +C ObjC C++ ObjC++ Var(warn_sync_nand) Init(1) Warning
> Warn when __sync_fetch_and_nand and __sync_nand_and_fetch built-in functions 
> are used.
> 
> Wsynth
> @@ -1900,35 +1900,35 @@ EnumValue
> Enum(on_off) String(on) Value(1)
> 
> fcontract-assumption-mode=
> -C++ Joined RejectNegative
> +C++ ObjC++ Joined RejectNegative
> -fcontract-assumption-mode=[on|off] Enable or disable treating axiom level 
> contracts as assumptions (default on).
> 
> fcontract-build-level=
> -C++ Joined RejectNegative
> +C++ ObjC++ Joined RejectNegative
> -fcontract-build-level=[off|default|audit] Specify max contract level to 
> generate runtime checks for.
> 
> fcontract-strict-declarations=
> -C++ Var(flag_contract_strict_declarations) Enum(on_off) Joined Init(0) 
> RejectNegative
> +C++ ObjC++ Var(flag_contract_strict_declarations) Enum(on_off) Joined 
> Init(0) RejectNegative
> -fcontract-strict-declarations=[on|off] Enable or disable warnings on 
> generalized redeclaration of functions with contracts (default off).
> 
> fcontract-mode=
> -C++ Var(flag_contract_mode) Enum(on_off) Joined Init(1) RejectNegative
> +C++ ObjC++ Var(flag_contract_mode) Enum(on_off) Joined Init(1) RejectNegative
> -fcontract-mode=[on|off] Enable or disable all contract facilities (default 
> on).
> 
> fcontract-continuation-mode=
> -C++ Joined RejectNegative
> +C++ ObjC++ Joined RejectNegative
> -fcontract-continuation-mode=[on|off] Enable or disable contract continuation 
> mode (default off).
> 
> fcontract-role=
> -C++ Joined RejectNegative
> +C++ ObjC++ Joined RejectNegative
> -fcontract-role=<name>:<semantics> Specify the semantics for all levels in a 
> role (default, review), or a custom contract role with given semantics (ex: 
> opt:assume,assume,assume).
> 
> fcontract-semantic=
> -C++ Joined RejectNegative
> +C++ ObjC++ Joined RejectNegative
> -fcontract-semantic=<level>:<semantic> Specify the concrete semantics for 
> level.
> 
> fcoroutines
> -C++ LTO Var(flag_coroutines)
> +C++ ObjC++ LTO Var(flag_coroutines)
> Enable C++ coroutines (experimental).
> 
> fdebug-cpp
> @@ -2130,23 +2130,23 @@ C ObjC Var(warn_compare_distinct_pointer
> Warn if pointers of distinct types are compared without a cast.
> 
> flang-info-include-translate
> -C++ Var(note_include_translate_yes)
> +C++ ObjC++ Var(note_include_translate_yes)
> Note #include directives translated to import declarations.
> 
> flang-info-include-translate-not
> -C++ Var(note_include_translate_no)
> +C++ ObjC++ Var(note_include_translate_no)
> Note #include directives not translated to import declarations, and not known 
> to be textual.
> 
> flang-info-include-translate=
> -C++ Joined RejectNegative MissingArgError(missing header name)
> +C++ ObjC++ Joined RejectNegative MissingArgError(missing header name)
> Note a #include translation of a specific header.
> 
> flang-info-module-cmi
> -C++ Var(note_module_cmi_yes)
> +C++ ObjC++ Var(note_module_cmi_yes)
> Note Compiled Module Interface pathnames.
> 
> flang-info-module-cmi=
> -C++ Joined RejectNegative MissingArgError(missing module name)
> +C++ ObjC++ Joined RejectNegative MissingArgError(missing module name)
> Note Compiled Module Interface pathname of a specific module or header-unit.
> 
> fmax-include-depth=
> @@ -2357,10 +2357,10 @@ C++ ObjC++ Var(flag_sized_deallocation)
> Enable C++14 sized deallocation support.
> 
> fstrict-flex-arrays
> -C C++ Common Alias(fstrict-flex-arrays=,3,0)
> +C ObjC C++ ObjC++ Common Alias(fstrict-flex-arrays=,3,0)
> 
> fstrict-flex-arrays=
> -C C++ Common Joined RejectNegative UInteger Var(flag_strict_flex_arrays) 
> Init(0) IntegerRange(0,3)
> +C ObjC C++ ObjC++ Common Joined RejectNegative UInteger 
> Var(flag_strict_flex_arrays) Init(0) IntegerRange(0,3)
> -fstrict-flex-arrays=<level>    Control when to treat the trailing array of a 
> structure as a flexible array member for the purposes of accessing the 
> elements of such an array. The default is treating all trailing arrays of 
> structures as flexible array members.
> 
> fsquangle
> 
> Jakub
> 

Reply via email to