git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Jeff King <peff@peff.net>
Cc: Denton Liu <liu.denton@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] Makefile: ASCII-sort += lists
Date: Fri, 9 Oct 2020 12:49:15 +0200 (CEST)	[thread overview]
Message-ID: <nycvar.QRO.7.76.6.2010091246420.50@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <20201008160816.GC2823778@coredump.intra.peff.net>

Hi Peff,

On Thu, 8 Oct 2020, Jeff King wrote:

> On Thu, Oct 08, 2020 at 12:06:47PM +0200, Johannes Schindelin wrote:
>
> > My little script also finds this:
> >
> > -- snip --
> > @@ -1231,8 +1231,8 @@ space := $(empty) $(empty)
> >
> >  ifdef SANITIZE
> >  SANITIZERS := $(foreach flag,$(subst $(comma),$(space),$(SANITIZE)),$(flag))
> > -BASIC_CFLAGS += -fsanitize=$(SANITIZE) -fno-sanitize-recover=$(SANITIZE)
> >  BASIC_CFLAGS += -fno-omit-frame-pointer
> > +BASIC_CFLAGS += -fsanitize=$(SANITIZE) -fno-sanitize-recover=$(SANITIZE)
> >  ifneq ($(filter undefined,$(SANITIZERS)),)
> >  BASIC_CFLAGS += -DSHA1DC_FORCE_ALIGNED_ACCESS
> >  endif
> > -- snap --
> >
> > I am not _so_ sure that we want to order `BASIC_CFLAGS`, but then, it does
> > not hurt, does it?
>
> I agree it would not be wrong to reorder here from the compiler's
> perspective, but:
>
>   - the current ordering is not arbitrary; the intent was to show that
>     we are enabling -fsanitize, and then follow it up with any other
>     related options (first any that apply to all sanitizers, of which
>     there is only one, and then any sanitizer-specific ones). The patch
>     above splits that logic apart.
>
>   - I'd worry that there are cases in which order _does_ matter to the
>     compiler. I'm not sure if anything that goes in CFLAGS might
>     qualify, but certainly order can matter for other parts of the
>     command-line (e.g., static library order).
>
>     So it might be setting us up for confusion later.

Fair enough. It's easy to exclude `.*_CFLAGS` via a negative look-behind:

	$key = '';
	@to_sort = ();
	while (<>) {
		if ($#to_sort >= 0) {
			if (/^$key \+=/) {
				push @to_sort, $_;
				next;
			}
			print join('', sort @to_sort);
			@to_sort = ();
		}
		if (/^(\S+(?<!_CFLAGS)) \+=/) {
			$key = $1;
			push @to_sort, $_;
		} else {
			print $_;
		}
	}

	if ($#to_sort >= 0) {
		print join('', sort @to_sort);
	}

Ciao,
Dscho

  reply	other threads:[~2020-10-09 13:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-08  7:39 [PATCH] Makefile: ASCII-sort += lists Denton Liu
2020-10-08 10:06 ` Johannes Schindelin
2020-10-08 16:08   ` Jeff King
2020-10-09 10:49     ` Johannes Schindelin [this message]
2020-10-09  1:45   ` Denton Liu
2020-10-09 10:51     ` Johannes Schindelin
2020-10-09 16:12       ` Junio C Hamano
2020-10-08 16:03 ` Jeff King
2020-10-08 17:38 ` Junio C Hamano

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=nycvar.QRO.7.76.6.2010091246420.50@tvgsbejvaqbjf.bet \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=liu.denton@gmail.com \
    --cc=peff@peff.net \
    /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 NNTP newsgroup(s).