diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-06-26 19:47:53 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-06-26 19:47:53 +0000 |
commit | b8f4fe4fd46fb9c5e1f53d4f3fcc87c7bd63ee7d (patch) | |
tree | bb59937427270405de6c99de7aa15707846d9b43 | |
parent | b0ea3d38b4e61b6d9705004e6f255164c7617213 (diff) | |
parent | a2df1ef4413144fe7d09a22f4750df05e83c13fb (diff) | |
download | system_core-b8f4fe4fd46fb9c5e1f53d4f3fcc87c7bd63ee7d.tar.gz system_core-b8f4fe4fd46fb9c5e1f53d4f3fcc87c7bd63ee7d.tar.bz2 system_core-b8f4fe4fd46fb9c5e1f53d4f3fcc87c7bd63ee7d.zip |
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
-rw-r--r-- | adb/Android.bp | 12 | ||||
-rw-r--r-- | adb/sysdeps.h | 10 | ||||
-rw-r--r-- | base/include/android-base/chrono_utils.h | 2 | ||||
-rw-r--r-- | base/include/android-base/stringprintf.h | 11 | ||||
-rw-r--r-- | fastboot/fastboot.h | 11 | ||||
-rw-r--r-- | liblog/include/android/log.h | 24 |
6 files changed, 11 insertions, 59 deletions
diff --git a/adb/Android.bp b/adb/Android.bp index 97c976203..c0e4c5758 100644 --- a/adb/Android.bp +++ b/adb/Android.bp @@ -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", + ], + }, }, } diff --git a/adb/sysdeps.h b/adb/sysdeps.h index 3be99f635..fe0ecd6ea 100644 --- a/adb/sysdeps.h +++ b/adb/sysdeps.h @@ -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 diff --git a/base/include/android-base/chrono_utils.h b/base/include/android-base/chrono_utils.h index c3396ee2f..b7647f22c 100644 --- a/base/include/android-base/chrono_utils.h +++ b/base/include/android-base/chrono_utils.h @@ -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 diff --git a/base/include/android-base/stringprintf.h b/base/include/android-base/stringprintf.h index 1fd6297fd..517e69e17 100644 --- a/base/include/android-base/stringprintf.h +++ b/base/include/android-base/stringprintf.h @@ -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, ...) diff --git a/fastboot/fastboot.h b/fastboot/fastboot.h index 2935eb57c..dc822e8bf 100644 --- a/fastboot/fastboot.h +++ b/fastboot/fastboot.h @@ -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))); diff --git a/liblog/include/android/log.h b/liblog/include/android/log.h index 52cbe8b71..ee9220d4a 100644 --- a/liblog/include/android/log.h +++ b/liblog/include/android/log.h @@ -115,16 +115,8 @@ int __android_log_write(int prio, const char* tag, const char* text); */ int __android_log_print(int prio, const char* tag, const char* fmt, ...) #if defined(__GNUC__) -#ifdef __USE_MINGW_ANSI_STDIO -#if __USE_MINGW_ANSI_STDIO - __attribute__((__format__(gnu_printf, 3, 4))) -#else __attribute__((__format__(printf, 3, 4))) #endif -#else - __attribute__((__format__(printf, 3, 4))) -#endif -#endif ; /** @@ -133,16 +125,8 @@ int __android_log_print(int prio, const char* tag, const char* fmt, ...) */ int __android_log_vprint(int prio, const char* tag, const char* fmt, va_list ap) #if defined(__GNUC__) -#ifdef __USE_MINGW_ANSI_STDIO -#if __USE_MINGW_ANSI_STDIO - __attribute__((__format__(gnu_printf, 3, 0))) -#else - __attribute__((__format__(printf, 3, 0))) -#endif -#else __attribute__((__format__(printf, 3, 0))) #endif -#endif ; /** @@ -164,16 +148,8 @@ void __android_log_assert(const char* cond, const char* tag, const char* fmt, ...) #if defined(__GNUC__) __attribute__((__noreturn__)) -#ifdef __USE_MINGW_ANSI_STDIO -#if __USE_MINGW_ANSI_STDIO - __attribute__((__format__(gnu_printf, 3, 4))) -#else - __attribute__((__format__(printf, 3, 4))) -#endif -#else __attribute__((__format__(printf, 3, 4))) #endif -#endif ; #ifndef log_id_t_defined |