Merge branch 'ss/msvc-path-utils-fix'
authorJunio C Hamano <gitster@pobox.com>
Wed, 8 May 2019 15:37:26 +0000 (00:37 +0900)
committerJunio C Hamano <gitster@pobox.com>
Wed, 8 May 2019 15:37:26 +0000 (00:37 +0900)
An earlier update for MinGW and Cygwin accidentally broke MSVC build,
which has been fixed.

* ss/msvc-path-utils-fix:
MSVC: include compat/win32/path-utils.h for MSVC, too, for real_path()

1  2 
config.mak.uname
git-compat-util.h
diff --combined config.mak.uname
index 3605fead53a79d4e37c92a026701b89fcce501c5,b7b8a716da11f2eaf3c7e3ccdc4c413e7b561edd..d56613a1397dc400c3903299816fc2aea345e9a0
@@@ -114,8 -114,6 +114,8 @@@ ifeq ($(uname_S),Darwin
        HAVE_BSD_SYSCTL = YesPlease
        FREAD_READS_DIRECTORIES = UnfortunatelyYes
        HAVE_NS_GET_EXECUTABLE_PATH = YesPlease
 +      BASIC_CFLAGS += -I/usr/local/include
 +      BASIC_LDFLAGS += -L/usr/local/lib
  endif
  ifeq ($(uname_S),SunOS)
        NEEDS_SOCKET = YesPlease
@@@ -223,7 -221,6 +223,7 @@@ ifeq ($(uname_S),FreeBSD
        HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
        PAGER_ENV = LESS=FRX LV=-c MORE=FRX
        FREAD_READS_DIRECTORIES = UnfortunatelyYes
 +      FILENO_IS_A_MACRO = UnfortunatelyYes
  endif
  ifeq ($(uname_S),OpenBSD)
        NO_STRCASESTR = YesPlease
        HAVE_BSD_SYSCTL = YesPlease
        HAVE_BSD_KERN_PROC_SYSCTL = YesPlease
        PROCFS_EXECUTABLE_PATH = /proc/curproc/file
 +      FREAD_READS_DIRECTORIES = UnfortunatelyYes
 +      FILENO_IS_A_MACRO = UnfortunatelyYes
  endif
  ifeq ($(uname_S),MirBSD)
        NO_STRCASESTR = YesPlease
@@@ -375,6 -370,7 +375,6 @@@ ifeq ($(uname_S),Windows
        RUNTIME_PREFIX = YesPlease
        HAVE_WPGMPTR = YesWeDo
        NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
 -      NO_NSEC = YesPlease
        USE_WIN32_MMAP = YesPlease
        MMAP_PREVENTS_DELETE = UnfortunatelyYes
        # USE_NED_ALLOCATOR = YesPlease
        NO_PYTHON = YesPlease
        BLK_SHA1 = YesPlease
        ETAGS_TARGET = ETAGS
 -      NO_INET_PTON = YesPlease
 -      NO_INET_NTOP = YesPlease
        NO_POSIX_GOODIES = UnfortunatelyYes
        NATIVE_CRLF = YesPlease
        DEFAULT_HELP_FORMAT = html
        CFLAGS =
        BASIC_CFLAGS = -nologo -I. -I../zlib -Icompat/vcbuild -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
        COMPAT_OBJS = compat/msvc.o compat/winansi.o \
+               compat/win32/path-utils.o \
                compat/win32/pthread.o compat/win32/syslog.o \
 +              compat/win32/trace2_win32_process_info.o \
                compat/win32/dirent.o
        COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
        BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE
@@@ -436,6 -434,8 +437,6 @@@ ifeq ($(uname_S),Minix
        NO_NSEC = YesPlease
        NEEDS_LIBGEN =
        NEEDS_CRYPTO_WITH_SSL = YesPlease
 -      NEEDS_IDN_WITH_CURL = YesPlease
 -      NEEDS_SSL_WITH_CURL = YesPlease
        NEEDS_RESOLV =
        NO_HSTRERROR = YesPlease
        NO_MMAP = YesPlease
@@@ -447,43 -447,27 +448,43 @@@ ifeq ($(uname_S),NONSTOP_KERNEL
        # INLINE='' would just replace one set of warnings with another and
        # still not compile in c89 mode, due to non-const array initializations.
        CC = cc -c99
 +      # Build down-rev compatible objects that don't use our new getopt_long.
 +      ifeq ($(uname_R).$(uname_V),J06.21)
 +              CC += -WRVU=J06.20
 +      endif
 +      ifeq ($(uname_R).$(uname_V),L17.02)
 +              CC += -WRVU=L16.05
 +      endif
        # Disable all optimization, seems to result in bad code, with -O or -O2
        # or even -O1 (default), /usr/local/libexec/git-core/git-pack-objects
        # abends on "git push". Needs more investigation.
 -      CFLAGS = -g -O0
 +      CFLAGS = -g -O0 -Winline
        # We'd want it to be here.
        prefix = /usr/local
 -      # Our's are in ${prefix}/bin (perl might also be in /usr/bin/perl).
 -      PERL_PATH = ${prefix}/bin/perl
 -      PYTHON_PATH = ${prefix}/bin/python
 -
 +      # perl and python must be in /usr/bin on NonStop - supplied by HPE
 +      # with operating system in that managed directory.
 +      PERL_PATH = /usr/bin/perl
 +      PYTHON_PATH = /usr/bin/python
 +      # The current /usr/coreutils/rm at lowest support level does not work
 +      # with the git test structure. Long paths as in
 +      # 'trash directory...' cause rm to terminate prematurely without fully
 +      # removing the directory at OS releases J06.21 and L17.02.
 +      # Default to the older rm until those two releases are deprecated.
 +      RM = /bin/rm -f
        # As detected by './configure'.
        # Missdetected, hence commented out, see below.
        #NO_CURL = YesPlease
        # Added manually, see above.
        NEEDS_SSL_WITH_CURL = YesPlease
 +      NEEDS_CRYPTO_WITH_SSL = YesPlease
 +      HAVE_DEV_TTY = YesPlease
        HAVE_LIBCHARSET_H = YesPlease
        HAVE_STRINGS_H = YesPlease
        NEEDS_LIBICONV = YesPlease
        NEEDS_LIBINTL_BEFORE_LIBICONV = YesPlease
        NO_SYS_SELECT_H = UnfortunatelyYes
        NO_D_TYPE_IN_DIRENT = YesPlease
 +      NO_GETTEXT = YesPlease
        NO_HSTRERROR = YesPlease
        NO_STRCASESTR = YesPlease
        NO_MEMMEM = YesPlease
        NO_MKDTEMP = YesPlease
        # Currently libiconv-1.9.1.
        OLD_ICONV = UnfortunatelyYes
 -      NO_REGEX = YesPlease
 +      NO_REGEX = NeedsStartEnd
        NO_PTHREADS = UnfortunatelyYes
 +      FREAD_READS_DIRECTORIES = UnfortunatelyYes
  
        # Not detected (nor checked for) by './configure'.
        # We don't have SA_RESTART on NonStop, unfortunalety.
        # RFE 10-120912-4693 submitted to HP NonStop development.
        NO_SETITIMER = UnfortunatelyYes
        SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
 -      SHELL_PATH = /usr/local/bin/bash
 -      # as of H06.25/J06.14, we might better use this
 -      #SHELL_PATH = /usr/coreutils/bin/bash
 +      SHELL_PATH = /usr/coreutils/bin/bash
  endif
  ifneq (,$(findstring MINGW,$(uname_S)))
        pathsep = ;
        NO_STRTOUMAX = YesPlease
        NO_MKDTEMP = YesPlease
        NO_SVN_TESTS = YesPlease
 -      NO_PERL_MAKEMAKER = YesPlease
        RUNTIME_PREFIX = YesPlease
        HAVE_WPGMPTR = YesWeDo
        NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
 -      NO_NSEC = YesPlease
        USE_WIN32_MMAP = YesPlease
        MMAP_PREVENTS_DELETE = UnfortunatelyYes
        USE_NED_ALLOCATOR = YesPlease
        NO_REGEX = YesPlease
        NO_PYTHON = YesPlease
        ETAGS_TARGET = ETAGS
 -      NO_INET_PTON = YesPlease
 -      NO_INET_NTOP = YesPlease
        NO_POSIX_GOODIES = UnfortunatelyYes
        DEFAULT_HELP_FORMAT = html
        COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32
        COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
        COMPAT_OBJS += compat/mingw.o compat/winansi.o \
 +              compat/win32/trace2_win32_process_info.o \
                compat/win32/path-utils.o \
                compat/win32/pthread.o compat/win32/syslog.o \
                compat/win32/dirent.o
        RC = windres -O coff
        NATIVE_CRLF = YesPlease
        X = .exe
 -      SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
  ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
        htmldir = doc/git/html/
        prefix =
        NO_GETTEXT = YesPlease
        COMPAT_CLFAGS += -D__USE_MINGW_ACCESS
  else
 -      ifeq ($(shell expr "$(uname_R)" : '2\.'),2)
 +      ifneq ($(shell expr "$(uname_R)" : '1\.'),2)
                # MSys2
                prefix = /usr/
                ifeq (MINGW32,$(MSYSTEM))
                        prefix = /mingw32
 +                      HOST_CPU = i686
                endif
                ifeq (MINGW64,$(MSYSTEM))
                        prefix = /mingw64
 +                      HOST_CPU = x86_64
                else
                        COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
                        BASIC_LDFLAGS += -Wl,--large-address-aware
diff --combined git-compat-util.h
index 31b47932bd5144f306a9aa1b122fdf3cb0886284,df9cc8cb58ba591274302495f12771c0238d55df..4386b3e1c874b587d1bbc0e99394d6c9c016830e
  #define _SGI_SOURCE 1
  
  #if defined(WIN32) && !defined(__CYGWIN__) /* Both MinGW and MSVC */
 -# if defined (_MSC_VER) && !defined(_WIN32_WINNT)
 -#  define _WIN32_WINNT 0x0502
 +# if !defined(_WIN32_WINNT)
 +#  define _WIN32_WINNT 0x0600
  # endif
  #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
  #include <winsock2.h>
  #include <regex.h>
  #include <utime.h>
  #include <syslog.h>
 -#ifndef NO_SYS_POLL_H
 +#if !defined(NO_POLL_H)
 +#include <poll.h>
 +#elif !defined(NO_SYS_POLL_H)
  #include <sys/poll.h>
  #else
 +/* Pull the compat stuff */
  #include <poll.h>
  #endif
  #ifdef HAVE_BSD_SYSCTL
  #include "compat/win32/path-utils.h"
  #include "compat/mingw.h"
  #elif defined(_MSC_VER)
+ #include "compat/win32/path-utils.h"
  #include "compat/msvc.h"
  #else
  #include <sys/utsname.h>
@@@ -346,14 -344,6 +347,14 @@@ typedef uintmax_t timestamp_t
  #define _PATH_DEFPATH "/usr/local/bin:/usr/bin:/bin"
  #endif
  
 +#ifndef platform_core_config
 +static inline int noop_core_config(const char *var, const char *value, void *cb)
 +{
 +      return 0;
 +}
 +#define platform_core_config noop_core_config
 +#endif
 +
  #ifndef has_dos_drive_prefix
  static inline int git_has_dos_drive_prefix(const char *path)
  {
@@@ -394,23 -384,6 +395,23 @@@ static inline char *git_find_last_dir_s
  #define find_last_dir_sep git_find_last_dir_sep
  #endif
  
 +#ifndef query_user_email
 +#define query_user_email() NULL
 +#endif
 +
 +#ifdef __TANDEM
 +#include <floss.h(floss_execl,floss_execlp,floss_execv,floss_execvp)>
 +#include <floss.h(floss_getpwuid)>
 +#ifndef NSIG
 +/*
 + * NonStop NSE and NSX do not provide NSIG. SIGGUARDIAN(99) is the highest
 + * known, by detective work using kill -l as a list is all signals
 + * instead of signal.h where it should be.
 + */
 +# define NSIG 100
 +#endif
 +#endif
 +
  #if defined(__HP_cc) && (__HP_cc >= 61000)
  #define NORETURN __attribute__((noreturn))
  #define NORETURN_PTR
  #define LAST_ARG_MUST_BE_NULL
  #endif
  
 +#define MAYBE_UNUSED __attribute__((__unused__))
 +
  #include "compat/bswap.h"
  
  #include "wildmatch.h"
@@@ -735,7 -706,7 +736,7 @@@ extern const char *githstrerror(int her
  #ifdef NO_MEMMEM
  #define memmem gitmemmem
  void *gitmemmem(const void *haystack, size_t haystacklen,
 -                const void *needle, size_t needlelen);
 +              const void *needle, size_t needlelen);
  #endif
  
  #ifdef OVERRIDE_STRDUP
@@@ -875,7 -846,6 +876,7 @@@ extern FILE *fopen_or_warn(const char *
  #define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  
  #define ALLOC_ARRAY(x, alloc) (x) = xmalloc(st_mult(sizeof(*(x)), (alloc)))
 +#define CALLOC_ARRAY(x, alloc) (x) = xcalloc((alloc), sizeof(*(x)));
  #define REALLOC_ARRAY(x, alloc) (x) = xrealloc((x), st_mult(sizeof(*(x)), (alloc)))
  
  #define COPY_ARRAY(dst, src, n) copy_array((dst), (src), (n), sizeof(*(dst)) + \
@@@ -1234,14 -1204,6 +1235,14 @@@ struct tm *git_gmtime_r(const time_t *
  #define getc_unlocked(fh) getc(fh)
  #endif
  
 +#ifdef FILENO_IS_A_MACRO
 +int git_fileno(FILE *stream);
 +# ifndef COMPAT_CODE
 +#  undef fileno
 +#  define fileno(p) git_fileno(p)
 +# endif
 +#endif
 +
  /*
   * Our code often opens a path to an optional file, to work on its
   * contents when we can successfully open it.  We can ignore a failure
@@@ -1259,13 -1221,6 +1260,13 @@@ static inline int is_missing_file_error
  
  extern int cmd_main(int, const char **);
  
 +/*
 + * Intercept all calls to exit() and route them to trace2 to
 + * optionally emit a message before calling the real exit().
 + */
 +int trace2_cmd_exit_fl(const char *file, int line, int code);
 +#define exit(code) exit(trace2_cmd_exit_fl(__FILE__, __LINE__, (code)))
 +
  /*
   * You can mark a stack variable with UNLEAK(var) to avoid it being
   * reported as a leak by tools like LSAN or valgrind. The argument