public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/53072] New: automatically set Init() only if option was not set in some other way
@ 2012-04-22 16:51 manu at gcc dot gnu.org
  2012-04-24 13:59 ` [Bug c/53072] " joseph at codesourcery dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-22 16:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53072

             Bug #: 53072
           Summary: automatically set Init() only if option was not set in
                    some other way
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: manu@gcc.gnu.org


Currently, it is possible to specify an initial value in the .opt file with
Init(). However, this value is set at the beginning, so it is (impossible?) to
know whether the value is the default or was set explicitly in some other way.
This is why many options are initialized to -1 instead.

The infrastructure to detect whether options have been set explicitly seems to
be there, but it is not clear how to use it to fix the above problem.


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

* [Bug c/53072] automatically set Init() only if option was not set in some other way
  2012-04-22 16:51 [Bug c/53072] New: automatically set Init() only if option was not set in some other way manu at gcc dot gnu.org
@ 2012-04-24 13:59 ` joseph at codesourcery dot com
  2012-04-24 14:11 ` manu at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: joseph at codesourcery dot com @ 2012-04-24 13:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53072

--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2012-04-24 13:59:10 UTC ---
On Sun, 22 Apr 2012, manu at gcc dot gnu.org wrote:

> The infrastructure to detect whether options have been set explicitly seems to
> be there, but it is not clear how to use it to fix the above problem.

My notion is that the _set information should move from being a boolean to 
recording the "distance" of the option that set some field from that field 
(it might be set by an option that directly corresponds to the field, or 
by one indirectly implying it, or a default if no relevant option is given 
at all).  Distance is in the sense of appendix 1 of 
<http://gcc.gnu.org/ml/gcc/2010-01/msg00063.html>.

This is explicitly not a detailed design; anyone implementing it would 
need to flesh out the details.


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

* [Bug c/53072] automatically set Init() only if option was not set in some other way
  2012-04-22 16:51 [Bug c/53072] New: automatically set Init() only if option was not set in some other way manu at gcc dot gnu.org
  2012-04-24 13:59 ` [Bug c/53072] " joseph at codesourcery dot com
@ 2012-04-24 14:11 ` manu at gcc dot gnu.org
  2012-04-24 14:44 ` joseph at codesourcery dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-24 14:11 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53072

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-24 14:10:48 UTC ---
(In reply to comment #1)
> On Sun, 22 Apr 2012, manu at gcc dot gnu.org wrote:
> This is explicitly not a detailed design; anyone implementing it would 
> need to flesh out the details.

Say we have: A enables B enables C. Do we actually need to track that C was
enabled by B or by A? Sorry I cannot imagine what for. 

For warning options, it is sufficient to track the C was enabled by other
option different from C. It seems we have most of the infrastructure to do
this, however, it is unclear how to use this infrastructure to make Init()
useful again, or implement  PR 53063.


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

* [Bug c/53072] automatically set Init() only if option was not set in some other way
  2012-04-22 16:51 [Bug c/53072] New: automatically set Init() only if option was not set in some other way manu at gcc dot gnu.org
  2012-04-24 13:59 ` [Bug c/53072] " joseph at codesourcery dot com
  2012-04-24 14:11 ` manu at gcc dot gnu.org
@ 2012-04-24 14:44 ` joseph at codesourcery dot com
  2012-04-24 14:51 ` manu at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: joseph at codesourcery dot com @ 2012-04-24 14:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53072

--- Comment #3 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2012-04-24 14:43:16 UTC ---
On Tue, 24 Apr 2012, manu at gcc dot gnu.org wrote:

> Say we have: A enables B enables C. Do we actually need to track that C was
> enabled by B or by A? Sorry I cannot imagine what for. 

The idea is that -WB -Wno-B leaves C disabled, but -WB -Wno-A leaves it 
enabled (because -WB is more specific than -Wno-A, it takes precedence 
whatever the ordering of those two options).  If there were any option -WC 
or -Wno-C on the command line, the last such option would apply regardless 
of the -WA / -Wno-A / -WB / -Wno-B options (that much at least is already 
implemented for some option implications).

> For warning options, it is sufficient to track the C was enabled by other
> option different from C. It seems we have most of the infrastructure to do

Even for that, you still need to move away from _set being a boolean, 
since there will be three values (default, explicit -WC / -Wno-C, 
controlled by some other option but not the most specific option).

> this, however, it is unclear how to use this infrastructure to make Init()
> useful again, or implement  PR 53063.

Init() should I think ideally be just for the defaults (with _set 
replacing the present uses of -1 or 2 in Init to mean "not set").


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

* [Bug c/53072] automatically set Init() only if option was not set in some other way
  2012-04-22 16:51 [Bug c/53072] New: automatically set Init() only if option was not set in some other way manu at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-04-24 14:44 ` joseph at codesourcery dot com
@ 2012-04-24 14:51 ` manu at gcc dot gnu.org
  2012-04-24 15:09 ` joseph at codesourcery dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-24 14:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53072

--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-24 14:49:54 UTC ---
(In reply to comment #3)
> 
> Init() should I think ideally be just for the defaults (with _set 
> replacing the present uses of -1 or 2 in Init to mean "not set").

Do you think it is possible to implement just this last part with _set being a
boolean? The code handling -Wb would still need to check explicitly that -Wc is
"not set", but the .opt file infrastructure will take care to set the value
Init() when "not set" after all command-line options have been processed.


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

* [Bug c/53072] automatically set Init() only if option was not set in some other way
  2012-04-22 16:51 [Bug c/53072] New: automatically set Init() only if option was not set in some other way manu at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2012-04-24 14:51 ` manu at gcc dot gnu.org
@ 2012-04-24 15:09 ` joseph at codesourcery dot com
  2012-04-28  0:17 ` manu at gcc dot gnu.org
  2012-05-13 22:34 ` manu at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: joseph at codesourcery dot com @ 2012-04-24 15:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53072

--- Comment #5 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2012-04-24 15:09:34 UTC ---
On Tue, 24 Apr 2012, manu at gcc dot gnu.org wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53072
> 
> --- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-24 14:49:54 UTC ---
> (In reply to comment #3)
> > 
> > Init() should I think ideally be just for the defaults (with _set 
> > replacing the present uses of -1 or 2 in Init to mean "not set").
> 
> Do you think it is possible to implement just this last part with _set being a
> boolean? The code handling -Wb would still need to check explicitly that -Wc is
> "not set", but the .opt file infrastructure will take care to set the value
> Init() when "not set" after all command-line options have been processed.

It may be possible - you'd need to avoid implicit setting marking the 
implied option as "set" - and I don't think delaying processing of Init() 
will actually be helpful anyway.


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

* [Bug c/53072] automatically set Init() only if option was not set in some other way
  2012-04-22 16:51 [Bug c/53072] New: automatically set Init() only if option was not set in some other way manu at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2012-04-24 15:09 ` joseph at codesourcery dot com
@ 2012-04-28  0:17 ` manu at gcc dot gnu.org
  2012-05-13 22:34 ` manu at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-28  0:17 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53072

--- Comment #6 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-28 00:17:33 UTC ---
(In reply to comment #5)
> 
> It may be possible - you'd need to avoid implicit setting marking the 
> implied option as "set" - and I don't think delaying processing of Init() 
> will actually be helpful anyway.

Then, I don't understand what is your plan. The current hack uses Init(-1) and
checks if warn_whatever == -1 as late as possible before setting the real
default value. My idea was to mimic this, but using the "set" structure instead
of -1, and using the Init value as the default value. A strategy to implement
this could be to introduce a new Default(), which will be set unconditionally
if the option is "unset". This will allow to get rid of Init(-1) incrementally.


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

* [Bug c/53072] automatically set Init() only if option was not set in some other way
  2012-04-22 16:51 [Bug c/53072] New: automatically set Init() only if option was not set in some other way manu at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2012-04-28  0:17 ` manu at gcc dot gnu.org
@ 2012-05-13 22:34 ` manu at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu.org @ 2012-05-13 22:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53072

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

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

--- Comment #7 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-05-13 22:30:34 UTC ---
This is being fixed by PR53063.

*** This bug has been marked as a duplicate of bug 53063 ***


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

end of thread, other threads:[~2012-05-13 22:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-22 16:51 [Bug c/53072] New: automatically set Init() only if option was not set in some other way manu at gcc dot gnu.org
2012-04-24 13:59 ` [Bug c/53072] " joseph at codesourcery dot com
2012-04-24 14:11 ` manu at gcc dot gnu.org
2012-04-24 14:44 ` joseph at codesourcery dot com
2012-04-24 14:51 ` manu at gcc dot gnu.org
2012-04-24 15:09 ` joseph at codesourcery dot com
2012-04-28  0:17 ` manu at gcc dot gnu.org
2012-05-13 22:34 ` manu 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).