]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
misc/bits/select2.h: Clearly separate declaration from definitions
authorFrédéric Bérat <fberat@redhat.com>
Wed, 26 Apr 2023 09:48:56 +0000 (11:48 +0200)
committerFrédéric Bérat <fberat@redhat.com>
Wed, 5 Jul 2023 14:59:48 +0000 (16:59 +0200)
The __fdelt_chk declaration needs to be available so that
libc_hidden_proto can be used while not redefining __FD_ELT.
Thus, misc/bits/select-decl.h is created to hold the corresponding
prototypes.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
debug/fdelt_chk.c
include/bits/select-decl.h [new file with mode: 0644]
include/sys/select.h
misc/Makefile
misc/bits/select-decl.h [new file with mode: 0644]
misc/bits/select2.h

index d1d3a19460fb99212f91f3c9e5a5d17e593530ca..bcf8f333f99fddec6c9608fb7a1e472f7c6f0079 100644 (file)
@@ -28,3 +28,4 @@ __fdelt_chk (long int d)
   return d / __NFDBITS;
 }
 strong_alias (__fdelt_chk, __fdelt_warn)
+libc_hidden_def (__fdelt_chk)
diff --git a/include/bits/select-decl.h b/include/bits/select-decl.h
new file mode 100644 (file)
index 0000000..43db738
--- /dev/null
@@ -0,0 +1 @@
+#include <misc/bits/select-decl.h>
index a8961afbed66dd8bfec1d101ddf389d8e2933063..45376461e9634b3b231771f42175d959a2f43eaa 100644 (file)
@@ -3,6 +3,10 @@
 
 #ifndef _ISOMAC
 /* Now define the internal interfaces.  */
+
+#include <bits/select-decl.h>
+libc_hidden_proto (__fdelt_chk)
+
 # if __TIMESIZE == 64
 #  define __pselect64 __pselect
 #  define __select64  __select
index 36ba7a0bad983a4a0d2c341da7bd2d87b5785956..3497d30f3bcf117217dee99ecde0a2bbe312fc7a 100644 (file)
@@ -68,6 +68,7 @@ headers       := \
   bits/syslog-ldbl.h \
   bits/syslog-path.h \
   bits/error.h \
+  bits/select-decl.h \
   bits/select2.h \
   bits/hwcap.h \
   sys/auxv.h \
diff --git a/misc/bits/select-decl.h b/misc/bits/select-decl.h
new file mode 100644 (file)
index 0000000..95962e1
--- /dev/null
@@ -0,0 +1,31 @@
+/* Checking routines for select functions. Declaration only.
+   Copyright (C) 2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _BITS_SELECT_DECL_H
+#define _BITS_SELECT_DECL_H 1
+
+#ifndef _SYS_SELECT_H
+# error "Never include <bits/select-decl.h> directly; use <sys/select.h> instead."
+#endif
+
+/* Helper functions to issue warnings and errors when needed.  */
+extern long int __fdelt_chk (long int __d);
+extern long int __fdelt_warn (long int __d)
+  __warnattr ("bit outside of fd_set selected");
+
+#endif
index abd84a19d5b8f76edbfd9d517c1703cd8fb94682..91e85c87d1e9e749d7918052aaeafc784179c9c4 100644 (file)
 # error "Never include <bits/select2.h> directly; use <sys/select.h> instead."
 #endif
 
-/* Helper functions to issue warnings and errors when needed.  */
-extern long int __fdelt_chk (long int __d);
-extern long int __fdelt_warn (long int __d)
-  __warnattr ("bit outside of fd_set selected");
+#include <bits/select-decl.h>
+
 #undef __FD_ELT
 #define        __FD_ELT(d) \
   __extension__                                                                    \