mbox series

[0/8] configure: Change to -std=gnu11

Message ID 20210611233347.653129-1-richard.henderson@linaro.org
Headers show
Series configure: Change to -std=gnu11 | expand

Message

Richard Henderson June 11, 2021, 11:33 p.m. UTC
Now that we assume gcc 7.5 as a minimum, we have the option
of changing to a newer C standard.  The two major ones that
I think apply are _Generic and _Static_assert.

While Paolo created a remarkably functional replacement for _Generic
using builtins, the error messages that you get out of the keyword
are *vastly* more intelligable, and the syntax is easier to read.

While I'd like to prefer _Static_assert over QEMU_BUILD_BUG_ON
going forward, and would like to convert existing uses, that is
a much bigger job.  Especially since the test condition is inverted.
In the meantime, can drop the configure detection.


r~


Richard Henderson (8):
  configure: Use -std=gnu11
  softfloat: Use _Generic instead of QEMU_GENERIC
  util: Use real functions for thread-posix QemuRecMutex
  util: Pass file+line to qemu_rec_mutex_unlock_impl
  util: Use unique type for QemuRecMutex in thread-posix.h
  include/qemu/lockable: Use _Generic instead of QEMU_GENERIC
  qemu/compiler: Remove QEMU_GENERIC
  configure: Remove probe for _Static_assert

 configure                   | 22 +---------
 meson.build                 |  2 +-
 include/qemu/compiler.h     | 51 ----------------------
 include/qemu/lockable.h     | 85 +++++++++++++++++++------------------
 include/qemu/thread-posix.h | 14 +++---
 include/qemu/thread-win32.h |  6 ---
 include/qemu/thread.h       | 15 ++++++-
 fpu/softfloat.c             | 16 ++++---
 util/qemu-thread-posix.c    | 24 ++++++++++-
 util/qemu-thread-win32.c    |  2 +-
 10 files changed, 100 insertions(+), 137 deletions(-)

-- 
2.25.1

Comments

Richard Henderson June 11, 2021, 11:36 p.m. UTC | #1
On 6/11/21 4:33 PM, Richard Henderson wrote:
> Now that we assume gcc 7.5 as a minimum, we have the option

> of changing to a newer C standard.  The two major ones that

> I think apply are _Generic and _Static_assert.


Poor editing there.  How about s/ones/new features/.


r~
Paolo Bonzini June 14, 2021, 11:15 a.m. UTC | #2
On 12/06/21 01:33, Richard Henderson wrote:
> Now that we assume gcc 7.5 as a minimum, we have the option

> of changing to a newer C standard.  The two major ones that

> I think apply are _Generic and _Static_assert.

> 

> While Paolo created a remarkably functional replacement for _Generic

> using builtins, the error messages that you get out of the keyword

> are*vastly*  more intelligable, and the syntax is easier to read.

> 

> While I'd like to prefer _Static_assert over QEMU_BUILD_BUG_ON

> going forward, and would like to convert existing uses, that is

> a much bigger job.  Especially since the test condition is inverted.

> In the meantime, can drop the configure detection.

> 


Looks good, thanks.  QEMU_GENERIC is the kind of thing that one can be 
both proud and ashamed of. :)

Paolo
no-reply@patchew.org June 14, 2021, 10:38 p.m. UTC | #3
Patchew URL: https://patchew.org/QEMU/20210611233347.653129-1-richard.henderson@linaro.org/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20210611233347.653129-1-richard.henderson@linaro.org
Subject: [PATCH 0/8] configure: Change to -std=gnu11

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]         patchew/20210610100802.5888-1-vsementsov@virtuozzo.com -> patchew/20210610100802.5888-1-vsementsov@virtuozzo.com
 * [new tag]         patchew/20210610142549.33220-1-zhangjiachen.jaycee@bytedance.com -> patchew/20210610142549.33220-1-zhangjiachen.jaycee@bytedance.com
Switched to a new branch 'test'
e40a971 configure: Remove probe for _Static_assert
1d4e941 qemu/compiler: Remove QEMU_GENERIC
c6f4654 include/qemu/lockable: Use _Generic instead of QEMU_GENERIC
f158a02 util: Use unique type for QemuRecMutex in thread-posix.h
a26bcbe util: Pass file+line to qemu_rec_mutex_unlock_impl
e1ba627 util: Use real functions for thread-posix QemuRecMutex
096aebf softfloat: Use _Generic instead of QEMU_GENERIC
1781658 configure: Use -std=gnu11

=== OUTPUT BEGIN ===
1/8 Checking commit 178165898450 (configure: Use -std=gnu11)
2/8 Checking commit 096aebfff18d (softfloat: Use _Generic instead of QEMU_GENERIC)
ERROR: spaces required around that '*' (ctx:WxO)
#22: FILE: fpu/softfloat.c:689:
+    _Generic((P), FloatParts64 *: parts64_##NAME, \
                                ^

ERROR: spaces required around that ':' (ctx:OxW)
#22: FILE: fpu/softfloat.c:689:
+    _Generic((P), FloatParts64 *: parts64_##NAME, \
                                 ^

ERROR: spaces required around that '*' (ctx:WxO)
#23: FILE: fpu/softfloat.c:690:
+                  FloatParts128 *: parts128_##NAME)
                                 ^

ERROR: spaces required around that ':' (ctx:OxW)
#23: FILE: fpu/softfloat.c:690:
+                  FloatParts128 *: parts128_##NAME)
                                  ^

ERROR: spaces required around that '*' (ctx:WxO)
#28: FILE: fpu/softfloat.c:693:
+    _Generic((P), FloatParts64 *: parts64_##NAME, \
                                ^

ERROR: spaces required around that ':' (ctx:OxW)
#28: FILE: fpu/softfloat.c:693:
+    _Generic((P), FloatParts64 *: parts64_##NAME, \
                                 ^

ERROR: spaces required around that '*' (ctx:WxO)
#29: FILE: fpu/softfloat.c:694:
+                  FloatParts128 *: parts128_##NAME, \
                                 ^

ERROR: spaces required around that ':' (ctx:OxW)
#29: FILE: fpu/softfloat.c:694:
+                  FloatParts128 *: parts128_##NAME, \
                                  ^

ERROR: spaces required around that '*' (ctx:WxO)
#30: FILE: fpu/softfloat.c:695:
+                  FloatParts256 *: parts256_##NAME)
                                 ^

ERROR: spaces required around that ':' (ctx:OxW)
#30: FILE: fpu/softfloat.c:695:
+                  FloatParts256 *: parts256_##NAME)
                                  ^

ERROR: spaces required around that '*' (ctx:WxO)
#39: FILE: fpu/softfloat.c:897:
+    _Generic((P), FloatParts64 *: frac64_##NAME, \
                                ^

ERROR: spaces required around that ':' (ctx:OxW)
#39: FILE: fpu/softfloat.c:897:
+    _Generic((P), FloatParts64 *: frac64_##NAME, \
                                 ^

ERROR: spaces required around that '*' (ctx:WxO)
#40: FILE: fpu/softfloat.c:898:
+                  FloatParts128 *: frac128_##NAME)
                                 ^

ERROR: spaces required around that ':' (ctx:OxW)
#40: FILE: fpu/softfloat.c:898:
+                  FloatParts128 *: frac128_##NAME)
                                  ^

ERROR: spaces required around that '*' (ctx:WxO)
#45: FILE: fpu/softfloat.c:901:
+    _Generic((P), FloatParts64 *: frac64_##NAME, \
                                ^

ERROR: spaces required around that ':' (ctx:OxW)
#45: FILE: fpu/softfloat.c:901:
+    _Generic((P), FloatParts64 *: frac64_##NAME, \
                                 ^

ERROR: spaces required around that '*' (ctx:WxO)
#46: FILE: fpu/softfloat.c:902:
+                  FloatParts128 *: frac128_##NAME, \
                                 ^

ERROR: spaces required around that ':' (ctx:OxW)
#46: FILE: fpu/softfloat.c:902:
+                  FloatParts128 *: frac128_##NAME, \
                                  ^

ERROR: spaces required around that '*' (ctx:WxO)
#47: FILE: fpu/softfloat.c:903:
+                  FloatParts256 *: frac256_##NAME)
                                 ^

ERROR: spaces required around that ':' (ctx:OxW)
#47: FILE: fpu/softfloat.c:903:
+                  FloatParts256 *: frac256_##NAME)
                                  ^

total: 20 errors, 0 warnings, 32 lines checked

Patch 2/8 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

3/8 Checking commit e1ba627d839b (util: Use real functions for thread-posix QemuRecMutex)
WARNING: line over 80 characters
#63: FILE: include/qemu/thread.h:34:
+int qemu_rec_mutex_trylock_impl(QemuRecMutex *mutex, const char *file, int line);

total: 0 errors, 1 warnings, 69 lines checked

Patch 3/8 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
4/8 Checking commit a26bcbe85cbc (util: Pass file+line to qemu_rec_mutex_unlock_impl)
WARNING: line over 80 characters
#27: FILE: include/qemu/thread.h:35:
+void qemu_rec_mutex_unlock_impl(QemuRecMutex *mutex, const char *file, int line);

total: 0 errors, 1 warnings, 47 lines checked

Patch 4/8 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
5/8 Checking commit f158a02b20b9 (util: Use unique type for QemuRecMutex in thread-posix.h)
6/8 Checking commit c6f46543912e (include/qemu/lockable: Use _Generic instead of QEMU_GENERIC)
ERROR: spaces required around that '*' (ctx:WxO)
#75: FILE: include/qemu/lockable.h:47:
+    _Generic((x), QemuMutex *: qemu_mutex_lock,        \
                             ^

ERROR: spaces required around that ':' (ctx:OxW)
#75: FILE: include/qemu/lockable.h:47:
+    _Generic((x), QemuMutex *: qemu_mutex_lock,        \
                              ^

ERROR: spaces required around that '*' (ctx:WxO)
#76: FILE: include/qemu/lockable.h:48:
+                  QemuRecMutex *: qemu_rec_mutex_lock, \
                                ^

ERROR: spaces required around that ':' (ctx:OxW)
#76: FILE: include/qemu/lockable.h:48:
+                  QemuRecMutex *: qemu_rec_mutex_lock, \
                                 ^

ERROR: spaces required around that '*' (ctx:WxO)
#77: FILE: include/qemu/lockable.h:49:
+                  CoMutex *: qemu_co_mutex_lock,       \
                           ^

ERROR: spaces required around that ':' (ctx:OxW)
#77: FILE: include/qemu/lockable.h:49:
+                  CoMutex *: qemu_co_mutex_lock,       \
                            ^

ERROR: spaces required around that '*' (ctx:WxO)
#78: FILE: include/qemu/lockable.h:50:
+                  QemuSpin *: qemu_spin_lock))
                            ^

ERROR: spaces required around that ':' (ctx:OxW)
#78: FILE: include/qemu/lockable.h:50:
+                  QemuSpin *: qemu_spin_lock))
                             ^

ERROR: spaces required around that '*' (ctx:WxO)
#81: FILE: include/qemu/lockable.h:53:
+    _Generic((x), QemuMutex *: qemu_mutex_unlock,        \
                             ^

ERROR: spaces required around that ':' (ctx:OxW)
#81: FILE: include/qemu/lockable.h:53:
+    _Generic((x), QemuMutex *: qemu_mutex_unlock,        \
                              ^

ERROR: spaces required around that '*' (ctx:WxO)
#82: FILE: include/qemu/lockable.h:54:
+                  QemuRecMutex *: qemu_rec_mutex_unlock, \
                                ^

ERROR: spaces required around that ':' (ctx:OxW)
#82: FILE: include/qemu/lockable.h:54:
+                  QemuRecMutex *: qemu_rec_mutex_unlock, \
                                 ^

ERROR: spaces required around that '*' (ctx:WxO)
#83: FILE: include/qemu/lockable.h:55:
+                  CoMutex *: qemu_co_mutex_unlock,       \
                           ^

ERROR: spaces required around that ':' (ctx:OxW)
#83: FILE: include/qemu/lockable.h:55:
+                  CoMutex *: qemu_co_mutex_unlock,       \
                            ^

ERROR: spaces required around that '*' (ctx:WxO)
#84: FILE: include/qemu/lockable.h:56:
+                  QemuSpin *: qemu_spin_unlock))
                            ^

ERROR: spaces required around that ':' (ctx:OxW)
#84: FILE: include/qemu/lockable.h:56:
+                  QemuSpin *: qemu_spin_unlock))
                             ^

ERROR: spaces required around that '*' (ctx:WxO)
#117: FILE: include/qemu/lockable.h:80:
+    _Generic((x), QemuLockable *: (x),                                  \
                                ^

ERROR: spaces required around that ':' (ctx:OxW)
#117: FILE: include/qemu/lockable.h:80:
+    _Generic((x), QemuLockable *: (x),                                  \
                                 ^

ERROR: spaces required around that '*' (ctx:WxO)
#118: FILE: include/qemu/lockable.h:81:
+             void *: qemu_null_lockable(x),                             \
                   ^

ERROR: spaces required around that ':' (ctx:OxW)
#118: FILE: include/qemu/lockable.h:81:
+             void *: qemu_null_lockable(x),                             \
                    ^

ERROR: spaces required around that '*' (ctx:WxO)
#119: FILE: include/qemu/lockable.h:82:
+             QemuMutex *: qemu_make_lockable(x, QML_OBJ_(x, mutex)),    \
                        ^

ERROR: spaces required around that ':' (ctx:OxW)
#119: FILE: include/qemu/lockable.h:82:
+             QemuMutex *: qemu_make_lockable(x, QML_OBJ_(x, mutex)),    \
                         ^

ERROR: spaces required around that '*' (ctx:WxO)
#120: FILE: include/qemu/lockable.h:83:
+             QemuRecMutex *: qemu_make_lockable(x, QML_OBJ_(x, rec_mutex)), \
                           ^

ERROR: spaces required around that ':' (ctx:OxW)
#120: FILE: include/qemu/lockable.h:83:
+             QemuRecMutex *: qemu_make_lockable(x, QML_OBJ_(x, rec_mutex)), \
                            ^

ERROR: spaces required around that '*' (ctx:WxO)
#121: FILE: include/qemu/lockable.h:84:
+             CoMutex *: qemu_make_lockable(x, QML_OBJ_(x, co_mutex)),   \
                      ^

ERROR: spaces required around that ':' (ctx:OxW)
#121: FILE: include/qemu/lockable.h:84:
+             CoMutex *: qemu_make_lockable(x, QML_OBJ_(x, co_mutex)),   \
                       ^

ERROR: spaces required around that '*' (ctx:WxO)
#122: FILE: include/qemu/lockable.h:85:
+             QemuSpin *: qemu_make_lockable(x, QML_OBJ_(x, spin)))
                       ^

ERROR: spaces required around that ':' (ctx:OxW)
#122: FILE: include/qemu/lockable.h:85:
+             QemuSpin *: qemu_make_lockable(x, QML_OBJ_(x, spin)))
                        ^

ERROR: spaces required around that '*' (ctx:WxO)
#138: FILE: include/qemu/lockable.h:96:
+    _Generic((x), QemuLockable *: (x),                          \
                                ^

ERROR: spaces required around that ':' (ctx:OxW)
#138: FILE: include/qemu/lockable.h:96:
+    _Generic((x), QemuLockable *: (x),                          \
                                 ^

ERROR: spaces required around that '*' (ctx:WxO)
#139: FILE: include/qemu/lockable.h:97:
+                  QemuMutex *: QML_OBJ_(x, mutex),              \
                             ^

ERROR: spaces required around that ':' (ctx:OxW)
#139: FILE: include/qemu/lockable.h:97:
+                  QemuMutex *: QML_OBJ_(x, mutex),              \
                              ^

ERROR: spaces required around that '*' (ctx:WxO)
#140: FILE: include/qemu/lockable.h:98:
+                  QemuRecMutex *: QML_OBJ_(x, rec_mutex),       \
                                ^

ERROR: spaces required around that ':' (ctx:OxW)
#140: FILE: include/qemu/lockable.h:98:
+                  QemuRecMutex *: QML_OBJ_(x, rec_mutex),       \
                                 ^

ERROR: spaces required around that '*' (ctx:WxO)
#141: FILE: include/qemu/lockable.h:99:
+                  CoMutex *: QML_OBJ_(x, co_mutex),             \
                           ^

ERROR: spaces required around that ':' (ctx:OxW)
#141: FILE: include/qemu/lockable.h:99:
+                  CoMutex *: QML_OBJ_(x, co_mutex),             \
                            ^

ERROR: spaces required around that '*' (ctx:WxO)
#142: FILE: include/qemu/lockable.h:100:
+                  QemuSpin *: QML_OBJ_(x, spin))
                            ^

ERROR: spaces required around that ':' (ctx:OxW)
#142: FILE: include/qemu/lockable.h:100:
+                  QemuSpin *: QML_OBJ_(x, spin))
                             ^

total: 38 errors, 0 warnings, 119 lines checked

Patch 6/8 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

7/8 Checking commit 1d4e941a6691 (qemu/compiler: Remove QEMU_GENERIC)
8/8 Checking commit e40a971de26b (configure: Remove probe for _Static_assert)
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20210611233347.653129-1-richard.henderson@linaro.org/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com