public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: cgd@broadcom.com
To: "Richard Sandiford" <rsandifo@redhat.com>
Cc: gcc-patches@gcc.gnu.org, binutils@sources.redhat.com,
	"Thiemo Seufer" <ica2_ts@csv.ica.uni-stuttgart.de>,
	"Maciej W. Rozycki" <macro@ds2.pg.gda.pl>,
	"Eric Christopher" <echristo@redhat.com>,
	"Mark D. Baushke" <mdb@gnu.org>
Subject: Re: [Revised patch] Rework MIPS command-line handling
Date: Fri, 19 Jul 2002 09:56:00 -0000	[thread overview]
Message-ID: <yov57kjrhdad.fsf@broadcom.com> (raw)
In-Reply-To: "Richard Sandiford"'s message of "19 Jul 2002 09:36:11 +0100"

At 19 Jul 2002 09:36:11 +0100, Richard Sandiford wrote:
> It seems counter-intuitive to me that a condition written using '=='
> should only be usable in preprocessor statements.  Many style guides
> ask you to use C conditions instead of preprocessor ones, but you
> wouldn't be able to write:
> 
>     if (_MIPS_ARCH == _PROCESSOR_LALALA)
>       ...

Yes you would.  It would have to look the same as the switch, though:

#ifdef _PROCESSOR_LALALA
    if (_MIPS_ARCH == _PROCESSOR_LALALA
	...
#endif


> There's also the chance of subtle errors, like:
> 
>     int optimize_for = _MIPS_TUNE;
> 
> and, in another file, perhaps part of a library:
> 
>     switch (optimize_for)
>       {
> #ifdef _PROCESSOR_LALALA
>       case _PROCESSOR_LALALA:
> 	...
> #endif
>       }
> 
> OK, it obviously wouldn't be supported under the _MIPS_TUNE == 1 or 2
> scheme, but it would compile, and having '_MIPS_TUNE == FOO' conditions
> might just lead people to believe that _MIPS_TUNE can be treated as a
> regular number (like __mips or __mips_fpr can).

one of the cases would compile at least.  If done with the 'tune'
setting, it should be OK if slower.  If done with the arch setting, it
could be painful.

I think the moral of the story here is... programmers need to exercise
_some_ small bit of care when coding and compiling for
optimization...

I suspect that not defining most of the values most of the time would
keep people from making the really silly errors.


> The optimiser will (ought to?) remove redundant code, so why force
> the user to wrap each case in '#ifdef's?  Why not allow...
> 
>     switch (_MIPS_ARCH)
>       {
>       case _PROCESSOR_LALALA:
>         ...
>       }
>
> And if we define all the _PROCESSOR_FOO macros for each compilation
> unit, we might as well try to give them lasting values...

If you want to define all of the _PROCESSOR_FOO macros for each
compilation unit, i suppose that'll work, but I think that solution is
really quite lame.

It's a _whole_ bunch of completely unnecessary definitions, which do
nothing except add stuff to the command line which will be irrelevant
99.9% of the time.  I actually think this might make debugging (people
using gcc -v then running the steps independently) a fair bit more
annoying, too.

I don't think there are enough that you'll be in danger of running any
system out of command line argument space... but it really does seem
absurd.

If the desire is to have them consistently dfined, then they should be
put into a header file.


> If that idea really doesn't fly, I'd rather have _MIPS_ARCH
> be a string and define _MIPS_ARCH_FOO when compiling for FOO.

You know, now that you mention it, i think that might actually be the
best solution.  (kind of a "back to the future" thing, but with the
addition of a string for _MIPS_ARCH.  8-)



chris

  parent reply	other threads:[~2002-07-19 16:51 UTC|newest]

Thread overview: 97+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-12 10:16 RFC & patch: " Richard Sandiford
2002-07-12 11:39 ` Maciej W. Rozycki
2002-07-12 12:28   ` Paul Koning
2002-07-15  4:50   ` Richard Sandiford
2002-07-15 13:18     ` Thiemo Seufer
2002-07-15 13:31       ` Eric Christopher
2002-07-15 13:59         ` Thiemo Seufer
2002-07-15 14:25           ` Eric Christopher
2002-07-15 14:30             ` Thiemo Seufer
2002-07-15 14:59               ` Eric Christopher
2002-07-15 15:04                 ` Thiemo Seufer
2002-07-15 17:26                   ` Eric Christopher
2002-07-16  3:54     ` Maciej W. Rozycki
2002-07-16  4:47       ` Mark D. Baushke
2002-07-16 11:33         ` Eric Christopher
     [not found]           ` <mailpost.1026843855.9110@news-sj1-1>
2002-07-16 18:18             ` cgd
2002-07-17  2:19               ` Maciej W. Rozycki
2002-07-17 15:18               ` Eric Christopher
2002-07-12 11:46 ` Eric Christopher
2002-07-12 12:46   ` Maciej W. Rozycki
2002-07-12 18:16     ` Eric Christopher
     [not found]       ` <mailpost.1026512166.22848@news-sj1-1>
2002-07-13 19:56         ` cgd
2002-07-15  5:39           ` Richard Sandiford
2002-07-14 11:38       ` Thiemo Seufer
2002-07-15  1:03       ` Maciej W. Rozycki
2002-07-15  3:13         ` Mark D. Baushke
2002-07-15  6:40           ` Richard Sandiford
     [not found]     ` <mailpost.1026503036.18648@news-sj1-1>
2002-07-13  0:52       ` cgd
2002-07-14 11:22     ` Thiemo Seufer
     [not found]   ` <mailpost.1026499181.16972@news-sj1-1>
2002-07-13  0:42     ` cgd
2002-07-14 10:53   ` Thiemo Seufer
2002-07-14 23:13     ` Maciej W. Rozycki
     [not found] ` <mailpost.1026493441.14222@news-sj1-1>
2002-07-13  0:40   ` cgd
2002-07-15  5:07     ` Richard Sandiford
     [not found]       ` <mailpost.1026733871.20742@news-sj1-1>
2002-07-15 11:04         ` cgd
2002-07-15 14:28           ` Eric Christopher
2002-07-16  3:23             ` Richard Sandiford
2002-07-16 12:16               ` Eric Christopher
     [not found]               ` <mailpost.1026812813.25035@news-sj1-1>
2002-07-16 17:48                 ` cgd
2002-07-14 10:43 ` Thiemo Seufer
2002-07-15  3:40   ` Richard Sandiford
2002-07-15  3:57     ` Mark D. Baushke
     [not found]       ` <mailpost.1026729642.18965@news-sj1-1>
2002-07-15 10:54         ` cgd
2002-07-15 11:02           ` Mark D. Baushke
2002-07-15 11:11             ` cgd
     [not found]     ` <mailpost.1026728027.18467@news-sj1-1>
2002-07-15 10:47       ` cgd
2002-07-15 11:22         ` Thiemo Seufer
     [not found]           ` <mailpost.1026757359.1135@news-sj1-1>
2002-07-16 17:24             ` cgd
2002-07-18 12:48               ` Thiemo Seufer
2002-07-18 13:09                 ` Eric Christopher
2002-07-16  4:04         ` Maciej W. Rozycki
2002-07-15 11:01     ` Thiemo Seufer
     [not found]       ` <mailpost.1026755685.506@news-sj1-1>
2002-07-15 11:24         ` cgd
2002-07-15 12:51           ` Thiemo Seufer
2002-07-16  3:57             ` Maciej W. Rozycki
2002-07-18 13:43               ` Thiemo Seufer
     [not found]             ` <mailpost.1026759415.2116@news-sj1-1>
2002-07-16 17:34               ` cgd
2002-07-16 18:56                 ` H. J. Lu
2002-07-16 18:57                   ` cgd
2002-07-18 13:57                 ` Thiemo Seufer
2002-07-16  4:45           ` Maciej W. Rozycki
2002-07-16  5:31           ` Richard Sandiford
2002-07-16 11:39             ` Eric Christopher
2002-07-18 14:44             ` Thiemo Seufer
2002-07-16  2:40       ` Richard Sandiford
2002-07-18 13:36         ` Thiemo Seufer
2002-07-16  4:17       ` Maciej W. Rozycki
2002-07-16  2:46     ` Maciej W. Rozycki
2002-07-16  8:01       ` Paul Koning
2002-07-16 11:01         ` Maciej W. Rozycki
2002-07-18 12:44 ` [Revised patch] " Richard Sandiford
2002-07-18 13:44   ` cgd
2002-07-18 18:12     ` Eric Christopher
2002-07-19  2:53     ` Richard Sandiford
2002-07-19  3:10       ` Mark D. Baushke
2002-07-19 10:11         ` cgd
2002-07-19  9:56       ` cgd [this message]
2002-07-22  3:47         ` Richard Sandiford
2002-07-22  4:19           ` Gerald Pfeifer
2002-07-22 11:13           ` Maciej W. Rozycki
2002-07-22 11:21             ` Richard Sandiford
2002-07-22 11:53             ` Eric Christopher
2002-07-22 12:12             ` Paul Koning
2002-07-22 13:13           ` Eric Christopher
     [not found]           ` <mailpost.1027334536.9318@news-sj1-1>
2002-07-22 15:13             ` cgd
2002-07-23  2:03               ` Richard Sandiford
     [not found]                 ` <mailpost.1027412600.13407@news-sj1-1>
2002-07-23  9:42                   ` cgd
2002-07-23  9:42                     ` Richard Sandiford
2002-07-23 10:04                       ` cgd
2002-07-23 10:16                         ` Richard Sandiford
2002-07-23 10:24                           ` cgd
2002-07-23 10:44                             ` Richard Sandiford
2002-07-23 10:52                               ` cgd
2002-07-23 11:38                                 ` Richard Sandiford
2002-07-23 13:18                                   ` Eric Christopher
2002-07-25  3:03           ` Richard Sandiford
2002-07-18 16:32   ` Thiemo Seufer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yov57kjrhdad.fsf@broadcom.com \
    --to=cgd@broadcom.com \
    --cc=binutils@sources.redhat.com \
    --cc=echristo@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ica2_ts@csv.ica.uni-stuttgart.de \
    --cc=macro@ds2.pg.gda.pl \
    --cc=mdb@gnu.org \
    --cc=rsandifo@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).