From: Junio C Hamano <gitster@pobox.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>,
git@vger.kernel.org, Adric Norris <landstander668@gmail.com>
Subject: Re: [PATCH 1/2] git version --build-options: report the build platform, too
Date: Fri, 08 Dec 2017 09:43:53 -0800 [thread overview]
Message-ID: <xmqq374l9kti.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20171208172324.GB14261@aiede.mtv.corp.google.com> (Jonathan Nieder's message of "Fri, 8 Dec 2017 09:23:24 -0800")
Jonathan Nieder <jrnieder@gmail.com> writes:
>> @@ -390,6 +390,7 @@ const char *help_unknown_cmd(const char *cmd)
>>
>> int cmd_version(int argc, const char **argv, const char *prefix)
>> {
>> + static char build_platform[] = GIT_BUILD_PLATFORM;
>> int build_options = 0;
>> const char * const usage[] = {
>> N_("git version [<options>]"),
>> @@ -413,6 +414,7 @@ int cmd_version(int argc, const char **argv, const char *prefix)
>>
>> if (build_options) {
>> printf("sizeof-long: %d\n", (int)sizeof(long));
>> + printf("machine: %s\n", build_platform);
>
> Can this use GIT_BUILD_PLATFORM directly instead of going via the indirection
> of a mutable static string? That is, something like
>
> printf("machine: %s\n", GIT_BUILD_PLATFORM);
Good point. And if this is externally identified as "machine",
probably the macro should also use the same word, not "platform".
We can go either way, as long as we are consistent, though.
>> --- a/help.h
>> +++ b/help.h
>> @@ -33,3 +33,16 @@ extern void list_commands(unsigned int colopts, struct cmdnames *main_cmds, stru
>> */
>> extern void help_unknown_ref(const char *ref, const char *cmd, const char *error);
>> #endif /* HELP_H */
>> +
>> +/*
>> + * identify build platform
>> + */
>> +#ifndef GIT_BUILD_PLATFORM
>> + #if defined __x86__ || defined __i386__ || defined __i586__ || defined __i686__
>> + #define GIT_BUILD_PLATFORM "x86"
>> + #elif defined __x86_64__
>> + #define GIT_BUILD_PLATFORM "x86_64"
>> + #else
>> + #define GIT_BUILD_PLATFORM "unknown"
>> + #endif
>> +#endif
>
> This code needs to be inside the HELP_H header guard.
Certainly.
Thanks.
next prev parent reply other threads:[~2017-12-08 17:43 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-08 17:01 [PATCH 0/2] Offer more information in `git version --build-options`'s output Johannes Schindelin
2017-12-08 17:02 ` [PATCH 1/2] git version --build-options: report the build platform, too Johannes Schindelin
2017-12-08 17:23 ` Jonathan Nieder
2017-12-08 17:43 ` Junio C Hamano [this message]
2017-12-08 21:17 ` Eric Sunshine
2017-12-08 21:19 ` Eric Sunshine
2017-12-09 9:43 ` Eric Sunshine
2017-12-09 14:17 ` Johannes Schindelin
2017-12-08 17:02 ` [PATCH 2/2] version --build-options: report commit, too, if possible Johannes Schindelin
2017-12-08 17:27 ` Jonathan Nieder
2017-12-08 17:49 ` Junio C Hamano
2017-12-14 23:27 ` Johannes Schindelin
2017-12-14 23:25 ` Johannes Schindelin
2017-12-14 23:34 ` [PATCH v2 0/2] Offer more information in `git version --build-options`'s output Johannes Schindelin
2017-12-14 23:34 ` [PATCH v2 1/2] version --build-options: also report host CPU Johannes Schindelin
2017-12-14 23:34 ` [PATCH v2 2/2] version --build-options: report commit, too, if possible Johannes Schindelin
2017-12-15 17:45 ` [PATCH v2 0/2] Offer more information in `git version --build-options`'s output Junio C Hamano
2017-12-15 18:03 ` Eric Sunshine
2017-12-15 18:12 ` 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
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=xmqq374l9kti.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=johannes.schindelin@gmx.de \
--cc=jrnieder@gmail.com \
--cc=landstander668@gmail.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).