]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/attr.h, lib/, src/: Move attributes to new header file
authorAlejandro Colomar <alx@kernel.org>
Tue, 28 Nov 2023 01:27:08 +0000 (02:27 +0100)
committerSerge Hallyn <serge@hallyn.com>
Sun, 3 Dec 2023 15:56:13 +0000 (09:56 -0600)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
26 files changed:
lib/Makefile.am
lib/agetpass.h
lib/alloc.h
lib/attr.h [new file with mode: 0644]
lib/audit_help.c
lib/cleanup_group.c
lib/cleanup_user.c
lib/copydir.c
lib/defines.h
lib/getdate.y
lib/logind.c
lib/loginprompt.c
lib/obscure.c
lib/pam_pass_non_interactive.c
lib/prototypes.h
lib/pwdcheck.c
lib/semanage.c
lib/sprintf.h
lib/stpeprintf.h
src/expiry.c
src/gpasswd.c
src/grpconv.c
src/grpunconv.c
src/login.c
src/su.c
src/sulogin.c

index bfe13c33ba30a6eed65a7f4de6bcb5458098cb57..36e04014d21c352b2e0069ed0adafc05f3841787 100644 (file)
@@ -28,6 +28,7 @@ libshadow_la_SOURCES = \
        agetpass.h \
        alloc.c \
        alloc.h \
+       attr.h \
        audit_help.c \
        basename.c \
        bit.c \
index d3613c15748dd57c238ffd87c286834d252cc3c9..1ee6a10702bc0de2c9bb70fa7ea2bc49368bc3db 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <config.h>
 
+#include "attr.h"
 #include "defines.h"
 
 
index dddb7a08711a8861c1fb9e4b8a0067103e6d68c3..0e04884947cae5bbb5e1686bd1ed1f0acc34b2d0 100644 (file)
@@ -17,6 +17,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 
+#include "attr.h"
 #include "defines.h"
 
 
diff --git a/lib/attr.h b/lib/attr.h
new file mode 100644 (file)
index 0000000..56a2e0c
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef SHADOW_INCLUDE_LIB_ATTR_H_
+#define SHADOW_INCLUDE_LIB_ATTR_H_
+
+
+#include "config.h"
+
+
+#if defined(__GNUC__)
+# define unused                      __attribute__((unused))
+# define NORETURN                    __attribute__((__noreturn__))
+# define format_attr(type, fmt, va)  __attribute__((format(type, fmt, va)))
+#else
+# define unused
+# define NORETURN
+# define format_attr(type, fmt, va)
+#endif
+
+#if (__GNUC__ >= 11) && !defined(__clang__)
+# define ATTR_MALLOC(deallocator)    [[gnu::malloc(deallocator)]]
+#else
+# define ATTR_MALLOC(deallocator)
+#endif
+
+
+#endif  // include guard
index 8c772a9db1d472a8c7c3df2aac0d8bc9e40a990d..060814399bf4bb22b477b9dac2f41f9491f7346c 100644 (file)
@@ -21,6 +21,8 @@
 #include <libaudit.h>
 #include <errno.h>
 #include <stdio.h>
+
+#include "attr.h"
 #include "prototypes.h"
 #include "shadowlog.h"
 int audit_fd;
index d2a08fc777952f102e046ae8531a3225209c2b59..5da38de471c1aff21cf41811f8518f0c51302c50 100644 (file)
@@ -9,6 +9,7 @@
 #include <assert.h>
 #include <stdio.h>
 
+#include "attr.h"
 #include "defines.h"
 #include "groupio.h"
 #include "sgroupio.h"
index da9260e59face825f222331b389e292fbda55475..ec8681ee58b03a9d8f09a1a299ee36da6bbd7a11 100644 (file)
@@ -9,6 +9,7 @@
 #include <assert.h>
 #include <stdio.h>
 
+#include "attr.h"
 #include "defines.h"
 #include "pwio.h"
 #include "shadowio.h"
index 6a80d7e7ea8da699278dd2a586a9bcbde4afabc1..6d292dafa8001046b009fe9a8812628cf2728afc 100644 (file)
@@ -19,6 +19,7 @@
 #include <stdio.h>
 
 #include "alloc.h"
+#include "attr.h"
 #include "prototypes.h"
 #include "defines.h"
 #ifdef WITH_SELINUX
index d0eb9dbdcd640dce98596da8a419cacb06c4f7e4..969b1aa93c620275e93799444fccad8c20076ef9 100644 (file)
 #include <libaudit.h>
 #endif
 
-/* To be used for verified unused parameters */
-#if defined(__GNUC__)
-# define unused    __attribute__((unused))
-# define NORETURN  __attribute__((__noreturn__))
-# define format_attr(type, index, check) __attribute__((format (type, index, check)))
-#else
-# define unused
-# define NORETURN
-# define format_attr(type, index, check)
-#endif
-
 /* Maximum length of passwd entry */
 #define PASSWD_ENTRY_MAX_LENGTH 32768
 
-#if (__GNUC__ >= 11) && !defined(__clang__)
-# define ATTR_MALLOC(deallocator)  [[gnu::malloc(deallocator)]]
-#else
-# define ATTR_MALLOC(deallocator)
-#endif
-
 #ifdef HAVE_SECURE_GETENV
 #  define shadow_getenv(name) secure_getenv(name)
 # else
index 2e13e2dc903dcb44e7237a2e17af02731e390024..59d8ffbbcf728f3ba12955fc8f1f753bf5aeb482 100644 (file)
@@ -28,6 +28,7 @@
 #include <ctype.h>
 #include <time.h>
 
+#include "attr.h"
 #include "getdate.h"
 
 #include <string.h>
index d4d217ceb6fe34e710810c8cc2789dfee797e550..e3bee9fabeffbbaebf8aca0655da76104efdacb2 100644 (file)
@@ -8,6 +8,7 @@
 
 #ident "$Id$"
 
+#include "attr.h"
 #include "defines.h"
 #include "prototypes.h"
 
index e2bef7ab0d762fa6dc8dbed481507304e96756e9..d7c3d6b9eefe9825a37331fc662fa784f339204c 100644 (file)
@@ -16,6 +16,7 @@
 #include <signal.h>
 
 #include "alloc.h"
+#include "attr.h"
 #include "memzero.h"
 #include "prototypes.h"
 #include "defines.h"
index 2aece68b7db992f76504291c9d2d6180ede985ba..cfc2735873c2fa40198c82f94d2850f933bc442c 100644 (file)
@@ -16,6 +16,7 @@
 #include <stdio.h>
 
 #include "alloc.h"
+#include "attr.h"
 #include "memzero.h"
 #include "prototypes.h"
 #include "defines.h"
index aec02ad8bbcdaedbddbdb47f7b75e7eecc1f2f14..6e21e76fbea4910330cac78537b31619dd0b9dc9 100644 (file)
@@ -18,6 +18,7 @@
 #include <security/pam_appl.h>
 
 #include "alloc.h"
+#include "attr.h"
 #include "prototypes.h"
 #include "shadowlog.h"
 
index 89a68e7c07b36a2d686239b9d973a28e61859c29..51118fd300516f9f52e73534b20cf5a4bbe05a09 100644 (file)
@@ -31,6 +31,7 @@
 #include <lastlog.h>
 #endif /* ENABLE_LASTLOG */
 
+#include "attr.h"
 #include "defines.h"
 #include "commonio.h"
 
index a1f85cefe6164b55bae5317621597ca7c5ffd133..e343fdafe011167c29913d43cba5df2c64943498 100644 (file)
@@ -13,6 +13,8 @@
 
 #include <stdio.h>
 #include <shadow.h>
+
+#include "attr.h"
 #include "prototypes.h"
 #include "defines.h"
 #include "pwauth.h"
index d412186c9df597474c5075eb78bc758b65180c04..742cf1124ba1f48710bce9e2fee0b53cbbd800d2 100644 (file)
 #endif
 #include <stdio.h>
 #include <stdarg.h>
+
 #include <selinux/selinux.h>
+
 #include <semanage/semanage.h>
+
+#include "attr.h"
 #include "prototypes.h"
 
 #include "shadowlog_internal.h"
index a1219f35d20f820b7faf517b6c6c3b46e8daeef3..c9d7e6c78e7f831a106cd8a2ccf5da2f2f614eac 100644 (file)
@@ -14,6 +14,7 @@
 #include <stddef.h>
 #include <stdio.h>
 
+#include "attr.h"
 #include "defines.h"
 
 
index 4929019a699d88e61509f7378e88560e80f85f38..14ee7b6ee4924027990e6dd12889bb15944831ea 100644 (file)
@@ -17,6 +17,7 @@
 #include <stddef.h>
 #include <stdio.h>
 
+#include "attr.h"
 #include "defines.h"
 
 
index b980b65653860ca4cd43193fce4099b18bd217bc..acccc2c8b4ed92c00be82e7a62ebcb1096c49401 100644 (file)
@@ -16,6 +16,8 @@
 #include <stdio.h>
 #include <sys/types.h>
 #include <getopt.h>
+
+#include "attr.h"
 #include "defines.h"
 #include "prototypes.h"
 /*@-exitarg@*/
index c08a50c8104ef76524764cb17a228aa7e0a14e04..e2aa0b13e001bf548c2fcb596b1665f083e146d0 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "agetpass.h"
 #include "alloc.h"
+#include "attr.h"
 #include "defines.h"
 #include "groupio.h"
 #include "memzero.h"
index 34ed7ad3851bd316de781575e326746f63e1176c..f60cae0fb050d379e4bae1edc02b36fcce8126b7 100644 (file)
@@ -26,6 +26,7 @@
 #include <unistd.h>
 #include <getopt.h>
 
+#include "attr.h"
 #include "nscd.h"
 #include "sssd.h"
 #include "prototypes.h"
index fc6cecf9377185c53cb74c9ba3115353b0ad535f..418245e1adb8b27bcbf549741377283d84a7becd 100644 (file)
@@ -24,6 +24,8 @@
 #include <unistd.h>
 #include <grp.h>
 #include <getopt.h>
+
+#include "attr.h"
 #include "nscd.h"
 #include "sssd.h"
 #include "prototypes.h"
index a4a59447de7dc51b498f9d408e86a2ef55a569b4..11abe0639b26ad4c83038e08a8a0c375852e38f0 100644 (file)
@@ -26,6 +26,7 @@
 #include <assert.h>
 
 #include "alloc.h"
+#include "attr.h"
 #include "defines.h"
 #include "faillog.h"
 #include "failure.h"
index a5731335e85d30d9320934541d345acc70ebee93..af5f29aee6a00fafc03e7a3d0a236ced1d73c7fc 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -47,6 +47,7 @@
 #endif                         /* !USE_PAM */
 
 #include "alloc.h"
+#include "attr.h"
 #include "prototypes.h"
 #include "defines.h"
 #include "pwauth.h"
index 4e1d601dd4b4f6a31cbf56e64bbe6ba1ad1ac3b7..eb99973f858df1f1ee7de21d1b6da024b5bd7703 100644 (file)
@@ -18,6 +18,7 @@
 #include <sys/ioctl.h>
 
 #include "agetpass.h"
+#include "attr.h"
 #include "defines.h"
 #include "getdef.h"
 #include "memzero.h"