public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug modula2/108555] New: gm2_langhook_option_lang_mask causes all (unappropriate) C language options to be recognized
@ 2023-01-26  9:46 rguenth at gcc dot gnu.org
  2023-01-26  9:51 ` [Bug modula2/108555] " rguenth at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-26  9:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108555

            Bug ID: 108555
           Summary: gm2_langhook_option_lang_mask causes all
                    (unappropriate) C language options to be recognized
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: modula2
          Assignee: gaius at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

137     static unsigned int
138     gm2_langhook_option_lang_mask (void)
139     {
140       /* We need to process some driver options and pass through some C
141          ones to build our preprocessing lines.  */
142       return CL_ModulaX2 | CL_C | CL_DRIVER;
143     }

we shouldn't add CL_C here but instead replicate the needed ones in
m2/lang.opt like other frontends do.  This for example causes
-Wreturn-type to be accepted and in the end causes PR108551

See fortran/lang.opt which for example has

I 
Fortran Joined Separate
; Documented in C

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug modula2/108555] gm2_langhook_option_lang_mask causes all (unappropriate) C language options to be recognized
  2023-01-26  9:46 [Bug modula2/108555] New: gm2_langhook_option_lang_mask causes all (unappropriate) C language options to be recognized rguenth at gcc dot gnu.org
@ 2023-01-26  9:51 ` rguenth at gcc dot gnu.org
  2023-01-26 10:19 ` iains at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-26  9:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108555

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
CL_DRIVER should also not be there

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug modula2/108555] gm2_langhook_option_lang_mask causes all (unappropriate) C language options to be recognized
  2023-01-26  9:46 [Bug modula2/108555] New: gm2_langhook_option_lang_mask causes all (unappropriate) C language options to be recognized rguenth at gcc dot gnu.org
  2023-01-26  9:51 ` [Bug modula2/108555] " rguenth at gcc dot gnu.org
@ 2023-01-26 10:19 ` iains at gcc dot gnu.org
  2023-01-26 12:26 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: iains at gcc dot gnu.org @ 2023-01-26 10:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108555

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |iains at gcc dot gnu.org

--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> ---
We do claim the ones that modula-2 actually uses in gm2-lang.opt

(previous to r13-5373-g80cf2c5e8f496b we had a large and growing set to
accommodate everything that the preprocessor needs).

Because of that growing number of added options, this change was made
intentionally... the idea was to claim and act on the C and Driver ones that
are used to construct C-preprocessor command lines as an action separate from
handling the Modula-2 options.

IIUC, the mechanism of adding them to the language opt is a convention rather
than a correctness issue?

Or is it that we should reject rather than ignoring the options that we do not
pass to the preprocessor?

(I can revert to adding everything to the gm2-lang.opt .. it just seemed a bit
hacky)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug modula2/108555] gm2_langhook_option_lang_mask causes all (unappropriate) C language options to be recognized
  2023-01-26  9:46 [Bug modula2/108555] New: gm2_langhook_option_lang_mask causes all (unappropriate) C language options to be recognized rguenth at gcc dot gnu.org
  2023-01-26  9:51 ` [Bug modula2/108555] " rguenth at gcc dot gnu.org
  2023-01-26 10:19 ` iains at gcc dot gnu.org
@ 2023-01-26 12:26 ` rguenth at gcc dot gnu.org
  2023-01-26 13:10 ` iains at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-26 12:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108555

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Iain Sandoe from comment #2)
> We do claim the ones that modula-2 actually uses in gm2-lang.opt
> 
> (previous to r13-5373-g80cf2c5e8f496b we had a large and growing set to
> accommodate everything that the preprocessor needs).
> 
> Because of that growing number of added options, this change was made
> intentionally... the idea was to claim and act on the C and Driver ones that
> are used to construct C-preprocessor command lines as an action separate
> from handling the Modula-2 options.
> 
> IIUC, the mechanism of adding them to the language opt is a convention
> rather than a correctness issue?

Kind-of ...

> Or is it that we should reject rather than ignoring the options that we do
> not pass to the preprocessor?

... yes, you are short-cutting generic code that diagnoses and removes
unappropriate options, I'm not sure simulating that behavior is easily
possible.

> (I can revert to adding everything to the gm2-lang.opt .. it just seemed a
> bit hacky)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug modula2/108555] gm2_langhook_option_lang_mask causes all (unappropriate) C language options to be recognized
  2023-01-26  9:46 [Bug modula2/108555] New: gm2_langhook_option_lang_mask causes all (unappropriate) C language options to be recognized rguenth at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-01-26 12:26 ` rguenth at gcc dot gnu.org
@ 2023-01-26 13:10 ` iains at gcc dot gnu.org
  2023-01-26 16:38 ` iains at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: iains at gcc dot gnu.org @ 2023-01-26 13:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108555

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|gaius at gcc dot gnu.org           |iains at gcc dot gnu.org

--- Comment #4 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #3)
> (In reply to Iain Sandoe from comment #2)

> ... yes, you are short-cutting generic code that diagnoses and removes
> unappropriate options, I'm not sure simulating that behavior is easily
> possible.

OK. I will rework it to claim the options in m2/lang.opt.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug modula2/108555] gm2_langhook_option_lang_mask causes all (unappropriate) C language options to be recognized
  2023-01-26  9:46 [Bug modula2/108555] New: gm2_langhook_option_lang_mask causes all (unappropriate) C language options to be recognized rguenth at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-01-26 13:10 ` iains at gcc dot gnu.org
@ 2023-01-26 16:38 ` iains at gcc dot gnu.org
  2023-01-26 20:30 ` iains at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: iains at gcc dot gnu.org @ 2023-01-26 16:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108555

--- Comment #5 from Iain Sandoe <iains at gcc dot gnu.org> ---
Created attachment 54355
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54355&action=edit
Partch under test - partial reversion of r13-5373-g80cf2c5e8f496b

This reverts the part of r13-5373-g80cf2c5e8f496b that claims *all* the C and
Driver options for Modula-2 .. instead we now add them to the lang.opt file.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug modula2/108555] gm2_langhook_option_lang_mask causes all (unappropriate) C language options to be recognized
  2023-01-26  9:46 [Bug modula2/108555] New: gm2_langhook_option_lang_mask causes all (unappropriate) C language options to be recognized rguenth at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-01-26 16:38 ` iains at gcc dot gnu.org
@ 2023-01-26 20:30 ` iains at gcc dot gnu.org
  2023-01-27  8:48 ` cvs-commit at gcc dot gnu.org
  2023-01-27 10:07 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: iains at gcc dot gnu.org @ 2023-01-26 20:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108555

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://gcc.gnu.org/piperma
                   |                            |il/gcc-patches/2023-January
                   |                            |/610676.html

--- Comment #6 from Iain Sandoe <iains at gcc dot gnu.org> ---
tested, posted.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug modula2/108555] gm2_langhook_option_lang_mask causes all (unappropriate) C language options to be recognized
  2023-01-26  9:46 [Bug modula2/108555] New: gm2_langhook_option_lang_mask causes all (unappropriate) C language options to be recognized rguenth at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-01-26 20:30 ` iains at gcc dot gnu.org
@ 2023-01-27  8:48 ` cvs-commit at gcc dot gnu.org
  2023-01-27 10:07 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-27  8:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108555

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:

https://gcc.gnu.org/g:83979240c072599bc8595a9324c3f4371eedbc7c

commit r13-5426-g83979240c072599bc8595a9324c3f4371eedbc7c
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Thu Jan 26 13:49:11 2023 +0000

    Modula-2: Add claimed command line options to lang.opt [PR108555].

    This is a partial reversion of the changes in r13-5373-g80cf2c5e8f496b.

    As observed in the PR, handling the C and Driver options in the Modula-2
    lang-specific code could be difficult to emulate; This reverts to adding
    the required options to the language-specific .opt file.

    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

            PR modula2/108555
            PR modula2/108182
            PR modula2/102343

    gcc/m2/ChangeLog:

            * gm2-lang.cc (gm2_langhook_option_lang_mask): Do not claim CL_C
            or CL_DRIVER.
            (gm2_langhook_init_options): Handle options that we want to pass
            to the preprocessor.
            * lang-specs.h: Pass -B and -save-temps to regular compile lines.
            * lang.opt: Add C and Driver options that Modula-2 intercepts for
            internal use. Reorder options into two sections and to collate.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug modula2/108555] gm2_langhook_option_lang_mask causes all (unappropriate) C language options to be recognized
  2023-01-26  9:46 [Bug modula2/108555] New: gm2_langhook_option_lang_mask causes all (unappropriate) C language options to be recognized rguenth at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2023-01-27  8:48 ` cvs-commit at gcc dot gnu.org
@ 2023-01-27 10:07 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-27 10:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108555

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Thanks a lot.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-01-27 10:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-26  9:46 [Bug modula2/108555] New: gm2_langhook_option_lang_mask causes all (unappropriate) C language options to be recognized rguenth at gcc dot gnu.org
2023-01-26  9:51 ` [Bug modula2/108555] " rguenth at gcc dot gnu.org
2023-01-26 10:19 ` iains at gcc dot gnu.org
2023-01-26 12:26 ` rguenth at gcc dot gnu.org
2023-01-26 13:10 ` iains at gcc dot gnu.org
2023-01-26 16:38 ` iains at gcc dot gnu.org
2023-01-26 20:30 ` iains at gcc dot gnu.org
2023-01-27  8:48 ` cvs-commit at gcc dot gnu.org
2023-01-27 10:07 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).