~lttng/urcu/trunk

  • Committer: Mathieu Desnoyers
  • Author(s): Sam James
  • Date: 2023-11-06 14:24:19 UTC
  • Revision ID: git-v1:81270292c23ff28aba1abd9a65f0624b657de82b
Fix -Walloc-size

GCC 14 introduces a new -Walloc-size included in -Wextra which gives:
```
urcu-call-rcu-impl.h:912:20: warning: allocation of insufficient size '1' for type 'struct call_rcu_completion' with size '16' [-Walloc-size[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Walloc-size]]
urcu-call-rcu-impl.h:927:22: warning: allocation of insufficient size '1' for type 'struct call_rcu_completion_work' with size '24' [-Walloc-size[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Walloc-size]]
urcu-call-rcu-impl.h:912:20: warning: allocation of insufficient size '1' for type 'struct call_rcu_completion' with size '16' [-Walloc-size[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Walloc-size]]
urcu-call-rcu-impl.h:927:22: warning: allocation of insufficient size '1' for type 'struct call_rcu_completion_work' with size '24' [-Walloc-size[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Walloc-size]]
urcu-call-rcu-impl.h:912:20: warning: allocation of insufficient size '1' for type 'struct call_rcu_completion' with size '16' [-Walloc-size[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Walloc-size]]
urcu-call-rcu-impl.h:927:22: warning: allocation of insufficient size '1' for type 'struct call_rcu_completion_work' with size '24' [-Walloc-size[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Walloc-size]]
urcu-call-rcu-impl.h:912:20: warning: allocation of insufficient size '1' for type 'struct call_rcu_completion' with size '16' [-Walloc-size[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Walloc-size]]
urcu-call-rcu-impl.h:927:22: warning: allocation of insufficient size '1' for type 'struct call_rcu_completion_work' with size '24' [-Walloc-size[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Walloc-size]]
urcu-call-rcu-impl.h:912:20: warning: allocation of insufficient size '1' for type 'struct call_rcu_completion' with size '16' [-Walloc-size[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Walloc-size]]
urcu-call-rcu-impl.h:927:22: warning: allocation of insufficient size '1' for type 'struct call_rcu_completion_work' with size '24' [-Walloc-size[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Walloc-size]]
workqueue.c:401:20: warning: allocation of insufficient size '1' for type 'struct urcu_workqueue_completion' with size '16' [-Walloc-size[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Walloc-size]]
workqueue.c:432:14: warning: allocation of insufficient size '1' for type 'struct urcu_workqueue_completion_work' with size '24' [-Walloc-size[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Walloc-size]]
urcu-call-rcu-impl.h:912:20: warning: allocation of insufficient size '1' for type 'struct call_rcu_completion' with size '16' [-Walloc-size[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Walloc-size]]
urcu-call-rcu-impl.h:927:22: warning: allocation of insufficient size '1' for type 'struct call_rcu_completion_work' with size '24' [-Walloc-size[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Walloc-size]]
qsbr.c:49:14: warning: allocation of insufficient size ‘1’ for type ‘struct mynode’ with size ‘40’ [-Walloc-size[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Walloc-size]]
mb.c:50:14: warning: allocation of insufficient size ‘1’ for type ‘struct mynode’ with size ‘40’ [-Walloc-size[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Walloc-size]]
membarrier.c:50:14: warning: allocation of insufficient size ‘1’ for type ‘struct mynode’ with size ‘40’ [-Walloc-size[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Walloc-size]]
signal.c:49:14: warning: allocation of insufficient size ‘1’ for type ‘struct mynode’ with size ‘40’ [-Walloc-size[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Walloc-size]]
bp.c:49:14: warning: allocation of insufficient size ‘1’ for type ‘struct mynode’ with size ‘40’ [-Walloc-size[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Walloc-size]]
```

The calloc prototype is:
```
void *calloc(size_t nmemb, size_t size);
```

So, just swap the number of members and size arguments to match the prototype, as
we're initialising 1 struct of size `sizeof(struct ...)`. GCC then sees we're not
doing anything wrong.

Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id84ce5cf9a1b97bfa942597aa188ef6e27e7c10d
Filename Latest Rev Last Changed Committer Comment Size
..
doc 761 11 years ago Mathieu Desnoyers Move API.txt to doc/rcu-api.txt, install in system Diff
extras 1348 2 years ago Mathieu Desnoyers Add serialized ABI definition files This commit c Diff
include 1191 7 years ago Mathieu Desnoyers Cleanup: Re-organise source dir Re-organise the s Diff
LICENSES 1444 10 months ago Mathieu Desnoyers Build system: use SPDX identifiers The SPDX ident Diff
m4 1142 8 years ago Mathieu Desnoyers Port: Fixes to build system for portability Move Diff
scripts 908 11 years ago Mathieu Desnoyers Add urcu-api-list.sh script Signed-off-by: Mathie Diff
src 1191 7 years ago Mathieu Desnoyers Cleanup: Re-organise source dir Re-organise the s Diff
tests 234 14 years ago Mathieu Desnoyers Move test programs to tests/ subdir Signed-off-by Diff
.gitignore 1444 10 months ago Mathieu Desnoyers Build system: use SPDX identifiers The SPDX ident 5.4 KB Diff Download File
.gitreview 1444 10 months ago Mathieu Desnoyers Build system: use SPDX identifiers The SPDX ident 205 bytes Diff Download File
File bootstrap 1444 10 months ago Mathieu Desnoyers Build system: use SPDX identifiers The SPDX ident 170 bytes Diff Download File
ChangeLog 1444 10 months ago Mathieu Desnoyers Build system: use SPDX identifiers The SPDX ident 42.7 KB Diff Download File
CodingStyle.md 1444 10 months ago Mathieu Desnoyers Build system: use SPDX identifiers The SPDX ident 436 bytes Diff Download File
configure.ac 1477 8 months ago Mathieu Desnoyers Complete removal of urcu-signal flavor This commi 12 KB Diff Download File
lgpl-relicensing.md 1444 10 months ago Mathieu Desnoyers Build system: use SPDX identifiers The SPDX ident 1.2 KB Diff Download File
LICENSE.md 1450 10 months ago Mathieu Desnoyers Complete REUSE support The SPDX identifiers [1] a 1.7 KB Diff Download File
Makefile.am 1450 10 months ago Mathieu Desnoyers Complete REUSE support The SPDX identifiers [1] a 901 bytes Diff Download File
README.md 1479 8 months ago Mathieu Desnoyers Add LoongArch support This commit completes Loong 16.1 KB Diff Download File