Re: [PATCH v9 5/5] bugreport: add compiler info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Emily,

On Mon, 2 Mar 2020, Emily Shaffer wrote:

> diff --git a/compat/compiler.h b/compat/compiler.h
> new file mode 100644
> index 0000000000..21f098e6a4
> --- /dev/null
> +++ b/compat/compiler.h
> @@ -0,0 +1,38 @@
> +#ifndef COMPILER_H
> +#define COMPILER_H
> +
> +#include "git-compat-util.h"
> +#include "strbuf.h"
> +
> +#ifdef __GLIBC__
> +#include <gnu/libc-version.h>
> +#endif
> +
> +static inline void get_compiler_info(struct strbuf *info)
> +{
> +	int len = info->len;
> +#ifdef __GNUC__
> +	strbuf_addf(info, "gnuc: %d.%d\n", __GNUC__, __GNUC_MINOR__);
> +#endif
> +
> +#ifdef _MSC_VER
> +	strbuf_addf(info, "MSVC version: %s\n", _MSC_FULL_VER);

I need this to fix a crash in the Visual Studio build's test run:

-- snip --
Subject: [PATCH] fixup??? bugreport: add compiler info

As documented at
https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=vs-2019,
`_MSC_FULL_VER` is an integer, not a string. Therefore this fix is
needed to prevent a segmentation fault in the test t0091.1.

Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
---
 compat/compiler.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/compat/compiler.h b/compat/compiler.h
index ce6a7f6de9a..ac90fa051dd 100644
--- a/compat/compiler.h
+++ b/compat/compiler.h
@@ -16,7 +16,8 @@ static inline void get_compiler_info(struct strbuf *info)
 #endif

 #ifdef _MSC_VER
-	strbuf_addf(info, "MSVC version: %s\n", _MSC_FULL_VER);
+	strbuf_addf(info, "MSVC version: %02d.%02d.%05d\n",
+		    _MSC_VER / 100, _MSC_VER % 100, _MSC_FULL_VER % 100000);
 #endif

 	if (len == info->len)
-- snap --

Could you squash that in, please?

BTW the two issues I reported in the earlier round are still problems.
Could you squash my fixes, please? For your convenience, you can pluck all
four of them right off of
https://github.com/git-for-windows/git/commits/shears/pu

Just replace the `???` by `!` and you can even use `git rebase
--autosquash`.

Ciao,
Dscho


> +#endif
> +
> +	if (len == info->len)
> +		strbuf_addf(info, _("no compiler information available\n"));
> +}
> +
> +static inline void get_libc_info(struct strbuf *info)
> +{
> +	int len = info->len;
> +
> +#ifdef __GLIBC__
> +	strbuf_addf(info, "glibc: %s\n", gnu_get_libc_version());
> +#endif
> +
> +	if (len == info->len)
> +		strbuf_addf(info, _("no libc information available\n"));
> +}
> +
> +#endif /* COMPILER_H */
> --
> 2.25.0.265.gbab2e86ba0-goog
>
>




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux