]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-common: add __const__
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 28 Oct 2024 08:13:10 +0000 (09:13 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 28 Oct 2024 08:23:07 +0000 (09:23 +0100)
const is stronger than pure, see
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-pure-function-attribute
and
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-const-function-attribute.

src/systemd/_sd-common.h

index dbe9fa035e7e12ba69373f6baaf041fa30016085..5792dd8106d167c8ba7f7c05cc5746227c808228 100644 (file)
@@ -45,6 +45,10 @@ typedef void (*_sd_destroy_t)(void *userdata);
 #  define _sd_pure_ __attribute__((__pure__))
 #endif
 
+#ifndef _sd_const_
+#  define _sd_const_ __attribute__((__const__))
+#endif
+
 /* Note that strictly speaking __deprecated__ has been available before GCC 6. However, starting with GCC 6
  * it also works on enum values, which we are interested in. Since this is a developer-facing feature anyway
  * (as opposed to build engineer-facing), let's hence conditionalize this to gcc 6, given that the developers