
Remove some complier warnings from msvc in compat/mingw.c for value truncation from 64 bit to 32 bit integers. Compiling compat/mingw.c under a 64 bit version of msvc produces warnings. An "int" is 32 bit, and ssize_t or size_t should be 64 bit long. Prepare compat/vcbuild/include/unistd.h to have a 64 bit type _ssize_t, when _WIN64 is defined and 32 bit otherwise. Further down in this include file, as before, ssize_t is defined as _ssize_t, if needed. Use size_t instead of int for all variables that hold the result of strlen() or wcslen() (which cannot be negative). Use ssize_t to hold the return value of read(). Signed-off-by: Sören Krecker <soekkle@freenet.de> Signed-off-by: Taylor Blau <me@ttaylorr.com>
41 lines
874 B
C
41 lines
874 B
C
#ifndef COMPILER_H
|
|
#define COMPILER_H
|
|
|
|
#include "strbuf.h"
|
|
|
|
#ifdef __GLIBC__
|
|
#include <gnu/libc-version.h>
|
|
#endif
|
|
|
|
static inline void get_compiler_info(struct strbuf *info)
|
|
{
|
|
size_t len = info->len;
|
|
#ifdef __clang__
|
|
strbuf_addf(info, "clang: %s\n", __clang_version__);
|
|
#elif defined(__GNUC__)
|
|
strbuf_addf(info, "gnuc: %d.%d\n", __GNUC__, __GNUC_MINOR__);
|
|
#endif
|
|
|
|
#ifdef _MSC_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)
|
|
strbuf_addstr(info, _("no compiler information available\n"));
|
|
}
|
|
|
|
static inline void get_libc_info(struct strbuf *info)
|
|
{
|
|
size_t len = info->len;
|
|
|
|
#ifdef __GLIBC__
|
|
strbuf_addf(info, "glibc: %s\n", gnu_get_libc_version());
|
|
#endif
|
|
|
|
if (len == info->len)
|
|
strbuf_addstr(info, _("no libc information available\n"));
|
|
}
|
|
|
|
#endif /* COMPILER_H */
|