On Wed, May 21, 2025 at 11:36:56PM +0200, Alejandro Colomar wrote:
> Hi Jakub,
> 
> On Wed, May 21, 2025 at 11:12:07PM +0200, Jakub Jelinek wrote:
> > >      warning_at (loc, OPT_Wc___compat,
> > >           "defining type in %qs expression is invalid in C++",
> > >           (in_sizeof
> > >            ? "sizeof"
> > > -          : (in_typeof ? "typeof" : "alignof")));
> > > +          : (in_typeof
> > > +             ? "typeof"
> > > +             : (in_alignof
> > > +                ? "alignof"
> > > +                : "_Countof"))));
> > 
> > Why so many lines?
> 
> Because IMO using two lines and breaking at a random point would make it
> less readable.  Which style do you prefer?  If you send me an exact way
> I should use, I'll paste it.

I propose:

diff --git i/gcc/c/c-decl.cc w/gcc/c/c-decl.cc
index 5bf638bfbd81..e6b8a84e50b1 100644
--- i/gcc/c/c-decl.cc
+++ w/gcc/c/c-decl.cc
@@ -8949,11 +8949,11 @@ start_struct (location_t loc, enum tree_code code, tree 
name,
                "defining type in %qs expression is invalid in C++",
                (in_sizeof
                 ? "sizeof"
-                : (in_typeof
-                   ? "typeof"
-                   : (in_alignof
-                      ? "alignof"
-                      : "_Countof"))));
+                : in_typeof
+                  ? "typeof"
+                  : in_alignof
+                    ? "alignof"
+                    : "_Countof"));
 
   if (in_underspecified_init)
     error_at (loc, "%qT defined in underspecified object initializer", ref);



-- 
<https://www.alejandro-colomar.es/>

Attachment: signature.asc
Description: PGP signature

Reply via email to