8 Commits

Author SHA1 Message Date
Alexander Kanavin
15524dd613 lib/attr.h: use C23 attributes only with gcc >= 10
These are not available on earlier versions and builds break there.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
2025-01-08 17:18:27 +01:00
Alejandro Colomar
a33d7430ed lib/attr.h: ATTR_STRING(): It only accepts one argument
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-07-08 20:25:01 -05:00
Alejandro Colomar
060b0849a6 lib/attr.h: Use C23-style attributes
They're stricter.  The GNU attributes are too lazy, and can be misused
more easily.  Also, mixing both has its own problems.

Link: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108796>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-07-01 21:40:11 -05:00
Alejandro Colomar
ba3a51e90f lib/: Use [[gnu::alloc_size(...)]] on allocation functions
Suggested-by: Martin Uecker <uecker@tugraz.at>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-07-01 21:40:11 -05:00
Pablo Saavedra
5d5d212764 lib/, src/: Rename 'unused' macro as 'MAYBE_UNUSED'
Related-To: https://github.com/shadow-maint/shadow/issues/918

Suggested-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Pablo Saavedra <psaavedra@igalia.com>
2024-01-30 16:19:56 +01:00
Alejandro Colomar
9ac5b2fc5a lib/attr.h: Add ATTR_ACCESS()
This will replace the existing comments like /*@out@*/

Link: <https://splint.org/manual/manual.html#undefined>
Cc: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-01-15 13:14:28 -06:00
Alejandro Colomar
a61cf0068b lib/attr.h: Add ATTR_STRING() attribute macro
It signals that a function parameter is a string _before_ the call.

Suggested-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-12-04 12:22:47 +01:00
Alejandro Colomar
44b8f7b3ef lib/attr.h, lib/, src/: Move attributes to new header file
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-12-03 09:56:13 -06:00