#ifndef GIT_COMPAT_UTIL_H
#define GIT_COMPAT_UTIL_H

#if __STDC_VERSION__ - 0 < 199901L
/*
 * Git is in a testing period for mandatory C99 support in the compiler.  If
 * your compiler is reasonably recent, you can try to enable C99 support (or,
 * for MSVC, C11 support).  If you encounter a problem and can't enable C99
 * support with your compiler (such as with "-std=gnu99") and don't have access
 * to one with this support, such as GCC or Clang, you can remove this #if
 * directive, but please report the details of your system to
 * git@vger.kernel.org.
 */
#error "Required C99 support is in a test phase.  Please see git-compat-util.h for more details."
#endif

#ifdef USE_MSVC_CRTDBG
/*
 * For these to work they must appear very early in each
 * file -- before most of the standard header files.
 */
#include <stdlib.h>
#include <crtdbg.h>
#endif

#include "compat/posix.h"

struct strbuf;

#if defined(__GNUC__) || defined(__clang__)
#  define PRAGMA(pragma)           _Pragma(#pragma)
#  define DISABLE_WARNING(warning) PRAGMA(GCC diagnostic ignored #warning)
#else
#  define DISABLE_WARNING(warning)
#endif

#undef FLEX_ARRAY
#define FLEX_ARRAY /* empty - weather balloon to require C99 FAM */

/*
 * BUILD_A

... [truncated 31259 chars] ...

n. false_but_the_compiler_does_not_know_it_
 * is defined in a compilation unit separate from where the macro is
 * used, initialized to 0, and never modified.
 */
#define NOT_CONSTANT(expr) ((expr) || false_but_the_compiler_does_not_know_it_)
extern int false_but_the_compiler_does_not_know_it_;

#ifdef CHECK_ASSERTION_SIDE_EFFECTS
#undef assert
extern int not_supposed_to_survive;
#define assert(expr) ((void)(not_supposed_to_survive || (expr)))
#endif /* CHECK_ASSERTION_SIDE_EFFECTS */

#endif

#ifdef DISABLE_SIGN_COMPARE_WARNINGS
DISABLE_WARNING(-Wsign-compare)
#endif
