- Explicitly check for minimum compiler versions

- Remove obsolete code for old compilers that is now not required anymore
 - Fix a duplicated typedef for Clang 3.4
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJcEM9uAAoJEC7Z13T+cC21Q18P+QEkPrbXiQVJX3NPCTYRq0e8
 v0RUdlspsxiQs/783oV593IPclnX2xFwbZnxR+1uecFSPWlm3F0d3XJnlUnPllZD
 Qf4VHcsg9JaVJto9vX9yPAYuwAraEjSyoQIfbblU9hLi8Vb7Pvz0HQKbIKHfXTzZ
 YJap/5MZBHpwVS2ahCubFQPY8I70lB6OPi++85MIuITxa1mr8Agi5jJFvNPlol5h
 gImMoPMvG8h38Jl/AOuzY9p/NGWAENa4TmRbkftVZHEMUv/Fo5sNsS5iuWc1V5lq
 2rjYNf0IsvH/0TB5A9WFaZOqiKgsa73TA3tBA8OiUoVsIVbSHHy6WYn2QtcinVE1
 LS84yAyn2jKAAPSBmOnBcuCH84f7kpHAJBj4J6ObmkDJ+0e0F4TNXYVFv0HlgH33
 8fxlPRfakOb76S2MdVX4SUe+xoxfEZx0c+7ADLD+mYTzBJuoTJYb9TfXvjwWe8A6
 nnAaORfooC8i6WSB2Lcw0k0l8R/ZwXT4M4Zv3H4t4jNK7kTDOpaWUK8K46ARjYvZ
 +dOFu5O3jfvxjrqZLHld6ai/n14WvYyhxEczr3T1EIALCqLub5qnxiQomNyoTWER
 PWtG4lRO6m1lL/fWr/ttVL/TS9rqHGk95PYIixs3QIEjEsG3SfjdWttVxCtiBELy
 rlDeu/c6Qu72YCe7On21
 =82XF
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2018-12-12' into staging

- Explicitly check for minimum compiler versions
- Remove obsolete code for old compilers that is now not required anymore
- Fix a duplicated typedef for Clang 3.4

# gpg: Signature made Wed 12 Dec 2018 09:05:50 GMT
# gpg:                using RSA key 2ED9D774FE702DB5
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>"
# gpg:                 aka "Thomas Huth <thuth@redhat.com>"
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>"
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>"
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* remotes/huth-gitlab/tags/pull-request-2018-12-12:
  i2c: Move typedef of bitbang_i2c_interface to i2c.h
  Remove QEMU_ARTIFICIAL macro
  includes: Replace QEMU_GNUC_PREREQ with "__has_builtin || !defined(__clang__)"
  audio/alsaaudio: Remove compiler check around pragma
  tcg/tcg.h: Remove GCC check for tcg_debug_assert() macro
  configure: Remove old -fno-gcse workaround for GCC 4.6.x and 4.7.[012]
  configure: Remove obsolete check for Clang < 3.2
  configure: Add a test for the minimum compiler version

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2018-12-14 10:19:47 +00:00
commit 0f98c99458
11 changed files with 32 additions and 45 deletions

View file

@ -158,9 +158,6 @@ GENERATED_FILES += hmp-commands.h hmp-commands-info.h
endif # CONFIG_SOFTMMU
# Workaround for http://gcc.gnu.org/PR55489, see configure.
%/translate.o: QEMU_CFLAGS += $(TRANSLATE_OPT_CFLAGS)
dummy := $(call unnest-vars,,obj-y)
all-obj-y := $(obj-y)

View file

@ -28,9 +28,7 @@
#include "audio.h"
#include "trace.h"
#if QEMU_GNUC_PREREQ(4, 3)
#pragma GCC diagnostic ignored "-Waddress"
#endif
#define AUDIO_CAP "alsa"
#include "audio_int.h"

47
configure vendored
View file

@ -1840,6 +1840,31 @@ if test "$bogus_os" = "yes"; then
error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')"
fi
# Check whether the compiler matches our minimum requirements:
cat > $TMPC << EOF
#if defined(__clang_major__) && defined(__clang_minor__)
# ifdef __apple_build_version__
# if __clang_major__ < 5 || (__clang_major__ == 5 && __clang_minor__ < 1)
# error You need at least XCode Clang v5.1 to compile QEMU
# endif
# else
# if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 4)
# error You need at least Clang v3.4 to compile QEMU
# endif
# endif
#elif defined(__GNUC__) && defined(__GNUC_MINOR__)
# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
# error You need at least GCC v4.8 to compile QEMU
# endif
#else
# error You either need GCC or Clang to compiler QEMU
#endif
int main (void) { return 0; }
EOF
if ! compile_prog "" "" ; then
error_exit "You need at least GCC v4.8 or Clang v3.4 (or XCode Clang v5.1)"
fi
gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
@ -1911,21 +1936,7 @@ else
QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces"
fi
# Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and
# large functions that use global variables. The bug is in all releases of
# GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in
# 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013.
cat > $TMPC << EOF
#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
int main(void) { return 0; }
#else
#error No bug in this compiler.
#endif
EOF
if compile_prog "-Werror -fno-gcse" "" ; then
TRANSLATE_OPT_CFLAGS=-fno-gcse
fi
# Static linking is not possible with modules or PIE
if test "$static" = "yes" ; then
if test "$modules" = "yes" ; then
error_exit "static and modules are mutually incompatible"
@ -5123,11 +5134,6 @@ fi
int128=no
cat > $TMPC << EOF
#if defined(__clang_major__) && defined(__clang_minor__)
# if ((__clang_major__ < 3) || (__clang_major__ == 3) && (__clang_minor__ < 2))
# error __int128_t does not work in CLANG before 3.2
# endif
#endif
__int128_t a;
__uint128_t b;
int main (void) {
@ -6963,7 +6969,6 @@ echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
echo "TASN1_LIBS=$tasn1_libs" >> $config_host_mak
echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak
echo "POD2MAN=$POD2MAN" >> $config_host_mak
echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
if test "$gcov" = "yes" ; then
echo "CONFIG_GCOV=y" >> $config_host_mak
echo "GCOV=$gcov_tool" >> $config_host_mak

View file

@ -3,8 +3,6 @@
#include "hw/i2c/i2c.h"
typedef struct bitbang_i2c_interface bitbang_i2c_interface;
#define BITBANG_I2C_SDA 0
#define BITBANG_I2C_SCL 1

View file

@ -82,6 +82,8 @@ int i2c_recv(I2CBus *bus);
DeviceState *i2c_create_slave(I2CBus *bus, const char *name, uint8_t addr);
typedef struct bitbang_i2c_interface bitbang_i2c_interface;
/* lm832x.c */
void lm832x_key_event(DeviceState *dev, int key, int state);

View file

@ -31,9 +31,6 @@
#include "hw/sysbus.h"
#include "hw/i2c/i2c.h"
/* from hw/i2c/bitbang_i2c.h */
typedef struct bitbang_i2c_interface bitbang_i2c_interface;
#define TYPE_PPC4xx_I2C "ppc4xx-i2c"
#define PPC4xx_I2C(obj) OBJECT_CHECK(PPC4xxI2CState, (obj), TYPE_PPC4xx_I2C)

View file

@ -28,12 +28,6 @@
#define QEMU_SENTINEL __attribute__((sentinel))
#if QEMU_GNUC_PREREQ(4, 3)
#define QEMU_ARTIFICIAL __attribute__((always_inline, artificial))
#else
#define QEMU_ARTIFICIAL
#endif
#if defined(_WIN32)
# define QEMU_PACKED __attribute__((gcc_struct, packed))
#else
@ -127,7 +121,7 @@
#define __has_builtin(x) 0 /* compatibility with non-clang compilers */
#endif
#if __has_builtin(__builtin_assume_aligned) || QEMU_GNUC_PREREQ(4, 7)
#if __has_builtin(__builtin_assume_aligned) || !defined(__clang__)
#define HAS_ASSUME_ALIGNED
#endif

View file

@ -207,7 +207,7 @@ static inline int cto64(uint64_t val)
*/
static inline int clrsb32(uint32_t val)
{
#if QEMU_GNUC_PREREQ(4, 7)
#if __has_builtin(__builtin_clrsb) || !defined(__clang__)
return __builtin_clrsb(val);
#else
return clz32(val ^ ((int32_t)val >> 1)) - 1;
@ -223,7 +223,7 @@ static inline int clrsb32(uint32_t val)
*/
static inline int clrsb64(uint64_t val)
{
#if QEMU_GNUC_PREREQ(4, 7)
#if __has_builtin(__builtin_clrsbll) || !defined(__clang__)
return __builtin_clrsbll(val);
#else
return clz64(val ^ ((int64_t)val >> 1)) - 1;

View file

@ -202,7 +202,6 @@ our $Attribute = qr{
QEMU_NORETURN|
QEMU_WARN_UNUSED_RESULT|
QEMU_SENTINEL|
QEMU_ARTIFICIAL|
QEMU_PACKED|
GCC_FMT_ATTR
}x;

View file

@ -23,7 +23,6 @@
#define QEMU_NORETURN __attribute__ ((__noreturn__))
#define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#define QEMU_SENTINEL __attribute__((sentinel))
#define QEMU_ARTIFICIAL __attribute__((always_inline, artificial))
#define QEMU_PACKED __attribute__((gcc_struct, packed))
#define cat(x,y) x ## y

View file

@ -230,11 +230,9 @@ typedef uint64_t tcg_insn_unit;
#if defined CONFIG_DEBUG_TCG || defined QEMU_STATIC_ANALYSIS
# define tcg_debug_assert(X) do { assert(X); } while (0)
#elif QEMU_GNUC_PREREQ(4, 5)
#else
# define tcg_debug_assert(X) \
do { if (!(X)) { __builtin_unreachable(); } } while (0)
#else
# define tcg_debug_assert(X) do { (void)(X); } while (0)
#endif
typedef struct TCGRelocation {