From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Johannes Sixt <j6t@kdbg.org>
Cc: Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>,
David Aguilar <davvid@gmail.com>,
Ramsay Jones <ramsay@ramsayjones.plus.com>,
GIT Mailing-list <git@vger.kernel.org>
Subject: Re: Fixing the warning about warning(""); was: Re: [PATCH] difftool.c: mark a file-local symbol with static
Date: Thu, 26 Jan 2017 12:37:46 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.20.1701261226220.3469@virtualbox> (raw)
In-Reply-To: <546179e0-1d6e-86f7-00cf-e13218b76de1@kdbg.org>
Hi Hannes,
On Thu, 26 Jan 2017, Johannes Sixt wrote:
> Am 25.01.2017 um 23:01 schrieb Jeff King:
> > +#pragma GCC diagnostic ignored "-Wformat-zero-length"
>
> Last time I used #pragma GCC in a cross-platform project, it triggered
> an "unknown pragma" warning for MSVC.
It is starting to become a little funny how many ways we can discuss the
resolution of the GCC compiler warning.
And it starts to show: we try to solve the thing in so many ways, just to
avoid the obviously most-trivial patch to change warning(""); to
warning("%s", "") (the change to warning(" "); would change behavior, but
I would be fine with that, too).
I am not really interested in any of these complicated workarounds. If you
gentle people decide they are better in Git's source code, go ahead. I do
not have to like what you are doing, I just have to work with it.
> (It was the C++ compiler, I don't know if the C compiler would also
> warn.) It would have to be spelled like this:
>
> #pragma warning(disable: 4068) /* MSVC: unknown pragma */
> #pragma GCC diagnostic ignored "-Wformat-zero-length"
>
> Dscho mentioned that he's compiling with MSVC. It would do him a favor.
I am compiling with MSVC, and the idea is to tap into that large number of
Windows developers who Git traditionally has had a really bad time
attracting. From that perspective, I would say it would not only do me a
favor, but anybody who builds Git for Windows using Visual Studio.
But we also have to consider whether it would do anybody a "dis-favor".
#pragma statements are by definition highly dependent on the compiler. I
have no idea whether there are developers out there building Git with
C compilers other than GCC, clang or MSVC (as I did back in the days on
IRIX and HP/UX), but there is quite the potential for problems here [*1*].
To keep Git's source code truly portable, the #pragma would have to be
guarded by a GCC-specific #ifdef ... #endif.
Ciao,
Dscho
Footnote *1*: This is just another instance where a discussion on the Git
mailing list reminds me of
http://thedailywtf.com/articles/The_Complicator_0x27_s_Gloves, as it tries
to avoid an obvious solution by trying to come up with a different
solution that in turn requires additional solutions to additional problems
caused by the alternative solution.
next prev parent reply other threads:[~2017-01-26 11:38 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-29 17:36 [PATCH] difftool.c: mark a file-local symbol with static Ramsay Jones
2016-11-30 11:07 ` Johannes Schindelin
2016-11-30 19:57 ` Ramsay Jones
2016-11-30 20:40 ` Junio C Hamano
2016-11-30 21:25 ` Jeff King
2016-11-30 22:37 ` Ramsay Jones
2016-11-30 23:18 ` Jeff King
2016-11-30 23:46 ` Junio C Hamano
2016-12-01 1:18 ` Ramsay Jones
2016-12-01 4:02 ` Jeff King
2016-12-01 18:20 ` Junio C Hamano
2016-12-01 18:50 ` Jeff King
2017-01-22 5:26 ` David Aguilar
2017-01-24 14:23 ` Jeff King
2017-01-24 21:52 ` Junio C Hamano
2017-01-24 23:05 ` Jeff King
2017-01-25 10:36 ` Fixing the warning about warning(""); was: " Johannes Schindelin
2017-01-25 18:35 ` Jeff King
2017-01-25 21:28 ` Junio C Hamano
2017-01-25 22:01 ` Jeff King
2017-01-26 6:39 ` Johannes Sixt
2017-01-26 11:37 ` Johannes Schindelin [this message]
2017-01-26 14:35 ` Jeff King
2017-01-26 14:32 ` Jeff King
2017-01-26 18:26 ` Junio C Hamano
2017-01-26 11:16 ` Johannes Schindelin
2017-01-26 14:39 ` Jeff King
2017-01-26 14:49 ` Johannes Schindelin
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.20.1701261226220.3469@virtualbox \
--to=johannes.schindelin@gmx.de \
--cc=davvid@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j6t@kdbg.org \
--cc=peff@peff.net \
--cc=ramsay@ramsayjones.plus.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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).