Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b8f4fe4f authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes from topic "mingw-clang"

* changes:
  Do not customize __format__ for Windows/MinGW to gnu_printf
  Adapt to switch to Clang for Windows host builds
  Update cflags for building Windows modules with Clang
parents b0ea3d38 a2df1ef4
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -19,17 +19,13 @@ cc_defaults {
        "-Wall",
        "-Wextra",
        "-Werror",
        "-Wexit-time-destructors",
        "-Wno-unused-parameter",
        "-Wno-missing-field-initializers",
        "-Wvla",
    ],
    rtti: true,

    clang_cflags: [
        "-Wexit-time-destructors",
        "-Wthread-safety",
    ],

    use_version_lib: true,

    compile_multilib: "first",
@@ -85,6 +81,12 @@ cc_defaults {
                "-luserenv",
            ],
        },

        not_windows: {
            cflags: [
                "-Wthread-safety",
            ],
        },
    },
}

+1 −9
Original line number Diff line number Diff line
@@ -41,16 +41,8 @@

// Some printf-like functions are implemented in terms of
// android::base::StringAppendV, so they should use the same attribute for
// compile-time format string checking. On Windows, if the mingw version of
// vsnprintf is used in StringAppendV, use `gnu_printf' which allows z in %zd
// and PRIu64 (and related) to be recognized by the compile-time checking.
// compile-time format string checking.
#define ADB_FORMAT_ARCHETYPE __printf__
#ifdef __USE_MINGW_ANSI_STDIO
#if __USE_MINGW_ANSI_STDIO
#undef ADB_FORMAT_ARCHETYPE
#define ADB_FORMAT_ARCHETYPE gnu_printf
#endif
#endif

#ifdef _WIN32

+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@
#include <chrono>
#include <sstream>

#if __cplusplus > 201103L  // C++14
#if __cplusplus > 201103L && !defined(__WIN32)  // C++14
using namespace std::chrono_literals;
#endif

+1 −10
Original line number Diff line number Diff line
@@ -24,17 +24,8 @@ namespace android {
namespace base {

// These printf-like functions are implemented in terms of vsnprintf, so they
// use the same attribute for compile-time format string checking. On Windows,
// if the mingw version of vsnprintf is used, use `gnu_printf' which allows z
// in %zd and PRIu64 (and related) to be recognized by the compile-time
// checking.
// use the same attribute for compile-time format string checking.
#define ANDROID_BASE_FORMAT_ARCHETYPE __printf__
#ifdef __USE_MINGW_ANSI_STDIO
#if __USE_MINGW_ANSI_STDIO
#undef ANDROID_BASE_FORMAT_ARCHETYPE
#define ANDROID_BASE_FORMAT_ARCHETYPE gnu_printf
#endif
#endif

// Returns a string corresponding to printf-like formatting of the arguments.
std::string StringPrintf(const char* fmt, ...)
+1 −10
Original line number Diff line number Diff line
@@ -78,17 +78,8 @@ char* xstrdup(const char*);
void set_verbose();

// These printf-like functions are implemented in terms of vsnprintf, so they
// use the same attribute for compile-time format string checking. On Windows,
// if the mingw version of vsnprintf is used, use `gnu_printf' which allows z
// in %zd and PRIu64 (and related) to be recognized by the compile-time
// checking.
// use the same attribute for compile-time format string checking.
#define FASTBOOT_FORMAT_ARCHETYPE __printf__
#ifdef __USE_MINGW_ANSI_STDIO
#if __USE_MINGW_ANSI_STDIO
#undef FASTBOOT_FORMAT_ARCHETYPE
#define FASTBOOT_FORMAT_ARCHETYPE gnu_printf
#endif
#endif
void die(const char* fmt, ...) __attribute__((__noreturn__))
__attribute__((__format__(FASTBOOT_FORMAT_ARCHETYPE, 1, 2)));
void verbose(const char* fmt, ...) __attribute__((__format__(FASTBOOT_FORMAT_ARCHETYPE, 1, 2)));
Loading