All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Cc: Junio C Hamano <gitster@pobox.com>,
	GIT Mailing-list <git@vger.kernel.org>,
	Peter Harris <git@peter.is-a-geek.org>
Subject: Re: [PATCH 4/4] Makefile: Don't pass $(ALL_CFLAGS) to the linker
Date: Sat, 26 Jun 2010 13:19:45 -0500	[thread overview]
Message-ID: <20100626181945.GA13070@burratino> (raw)
In-Reply-To: <4C264019.6030408@ramsay1.demon.co.uk>

Ramsay Jones wrote:

> I thought that the general scheme was something like:
> 
>     - LDFLAGS is for options which only affects the operation of
>       the linker (e.g. -L).
>     - CPPFLAGS is for options which only affects the operation of
>       the C pre-processor (e.g. -I, -D, -U)
>     - CFLAGS is for options which only affects the operation of
>       the compiler proper.
>
> If an option affects multiple phases, then (one option) is to include
> it into each of the above macros to which it applies.

That does make sense.  Perhaps “traditionally” was not the right word;
I was just looking at common practice.  I’ve just never seen -O put
into LDFLAGS, for example, and I think most people would expect
setting CFLAGS=-O0 to affect the linker, too.

> Jonathan Nieder wrote:

>> I realize that the Makefile does not currently use the terms this way:
>> making it consistent would require
>> 
>>  . s/BASIC_CFLAGS/BASIC_CPPFLAGS/, except that the
[etc]
>> 
>> What do you think?
>
> I think I am missing something, since I don't see how this relates to
> my patch!

I suspect the problem comes from my unfamiliarity with MSVC.

By analogy with GCC, I assumed that any parameter is intended for the
preprocessor, the linker, or the frontend/both.  In other words, I was
assuming flags for the compiler proper can be safely passed to the
linker, and that /Zi must be for the preprocessor-using stages only.
CFLAGS tends to contain front-end arguments used for all stages of
translation.

What does /Zi do?  Searching online reveals:

 - it means “enable debugging information”
 - weakly implies /debug for the linker
 - overrides /Z7 and /Zd, and is overridden by them
 - is incompatible with /MP
 - is among the prerequisites for /dlp and for /Gm

Maybe clink.pl should use “cl.exe /link” instead of “link.exe” and this
problem would go away.

  reply	other threads:[~2010-06-26 18:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-23 19:48 [PATCH 4/4] Makefile: Don't pass $(ALL_CFLAGS) to the linker Ramsay Jones
2010-06-23 21:08 ` Jonathan Nieder
2010-06-26 17:59   ` Ramsay Jones
2010-06-26 18:19     ` Jonathan Nieder [this message]
2010-06-30 19:40       ` Ramsay Jones
2010-06-30 21:16         ` Andreas Schwab
2010-06-27  9:44     ` Bernhard R. Link
2010-06-24 15:30 ` Peter Harris
2010-06-25 20:24   ` Ramsay Jones
2010-06-27 20:45     ` Peter Harris
2010-06-30 19:52       ` Ramsay Jones
2010-07-01 21:27         ` Peter Harris

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=20100626181945.GA13070@burratino \
    --to=jrnieder@gmail.com \
    --cc=git@peter.is-a-geek.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ramsay@ramsay1.demon.co.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.