]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
selinux-h: Fix compilation errors and link errors in C++ mode.
authorBruno Haible <bruno@clisp.org>
Sat, 17 Jan 2026 00:52:09 +0000 (01:52 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 17 Jan 2026 00:52:09 +0000 (01:52 +0100)
* lib/se-selinux.in.h: Mark the functions as 'extern "C"'.
* lib/se-label.in.h: Mark the functions as 'extern "C"'. Avoid implicit
casts from 'void *' to other pointer types.
* lib/se-context.in.h: Likewise.
(context_t): Don't use 'struct context_t'.

ChangeLog
lib/se-context.in.h
lib/se-label.in.h
lib/se-selinux.in.h

index e104502a27fc1220fb4001ec9333813bd024b15e..a8555e59e99a71decd90c497c4c91684317379bc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2026-01-16  Bruno Haible  <bruno@clisp.org>
+
+       selinux-h: Fix compilation errors and link errors in C++ mode.
+       * lib/se-selinux.in.h: Mark the functions as 'extern "C"'.
+       * lib/se-label.in.h: Mark the functions as 'extern "C"'. Avoid implicit
+       casts from 'void *' to other pointer types.
+       * lib/se-context.in.h: Likewise.
+       (context_t): Don't use 'struct context_t'.
+
 2026-01-16  Paul Eggert  <eggert@cs.ucla.edu>
 
        manywarnings: omit new C warning for GCC < 15
index 37cc7a6dff713ff53efaad3b66d7dc981b173c1e..ca6e97a14fab22c8301f2daee3a3d0d6c7c8d737 100644 (file)
@@ -41,14 +41,18 @@ _GL_INLINE_HEADER_BEGIN
 # endif
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 
-typedef struct context_t *context_t;
+typedef struct selinux_context_t *context_t;
 SE_CONTEXT_INLINE context_t
 context_new (char const *_GL_UNNAMED (s))
-  { errno = ENOTSUP; return (void *) 0; }
+  { errno = ENOTSUP; return (context_t) 0; }
 SE_CONTEXT_INLINE char *
 context_str (context_t _GL_UNNAMED (con))
-  { errno = ENOTSUP; return (void *) 0; }
+  { errno = ENOTSUP; return (char *) 0; }
 SE_CONTEXT_INLINE void context_free (context_t _GL_UNNAMED (c)) {}
 
 SE_CONTEXT_INLINE int
@@ -65,16 +69,21 @@ context_type_set (context_t _GL_UNNAMED (sc), char const *_GL_UNNAMED (s))
   { errno = ENOTSUP; return -1; }
 SE_CONTEXT_INLINE char *
 context_type_get (context_t _GL_UNNAMED (sc))
-  { errno = ENOTSUP; return (void *) 0; }
+  { errno = ENOTSUP; return (char *) 0; }
 SE_CONTEXT_INLINE char *
 context_range_get (context_t _GL_UNNAMED (sc))
-  { errno = ENOTSUP; return (void *) 0; }
+  { errno = ENOTSUP; return (char *) 0; }
 SE_CONTEXT_INLINE char *
 context_role_get (context_t _GL_UNNAMED (sc))
-  { errno = ENOTSUP; return (void *) 0; }
+  { errno = ENOTSUP; return (char *) 0; }
 SE_CONTEXT_INLINE char *
 context_user_get (context_t _GL_UNNAMED (sc))
-  { errno = ENOTSUP; return (void *) 0; }
+  { errno = ENOTSUP; return (char *) 0; }
+
+
+#ifdef __cplusplus
+}
+#endif
 
 _GL_INLINE_HEADER_END
 
index 159adb669367eaa8eaad54f4ad79c300e51a3069..f1f6d2dbadbacf290ec990a113e165d2334bad0e 100644 (file)
@@ -42,6 +42,11 @@ _GL_INLINE_HEADER_BEGIN
 # endif
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
 #define SELABEL_CTX_FILE 0
 
 struct selabel_handle;
@@ -64,12 +69,17 @@ SE_LABEL_INLINE struct selabel_handle *
 selabel_open (int _GL_UNNAMED (backend),
               struct selinux_opt *_GL_UNNAMED (options),
               unsigned _GL_UNNAMED (nopt))
-{ errno = ENOTSUP; return (void *) 0; }
+{ errno = ENOTSUP; return (struct selabel_handle *) 0; }
 
 SE_LABEL_INLINE void
 selabel_close (struct selabel_handle *_GL_UNNAMED (hnd))
 { errno = ENOTSUP; }
 
+
+#ifdef __cplusplus
+}
+#endif
+
 _GL_INLINE_HEADER_END
 
 #endif
index a62de9c9df6f3cc40ca25532754d0f3afd70720f..8094bc13aa78e7626d9b55070d9b487049e656f4 100644 (file)
@@ -50,6 +50,11 @@ _GL_INLINE_HEADER_BEGIN
 #   endif
 #  endif
 
+#  ifdef __cplusplus
+extern "C" {
+#  endif
+
+
 #  if !GNULIB_defined_security_types
 
 typedef unsigned short security_class_t;
@@ -153,6 +158,11 @@ matchpathcon_init_prefix (char const *_GL_UNNAMED (path),
 #   define GNULIB_defined_security_types 1
 #  endif
 
+
+#  ifdef __cplusplus
+}
+#  endif
+
 _GL_INLINE_HEADER_END
 
 # endif /* _@GUARD_PREFIX@_SELINUX_SELINUX_H */