summaryrefslogtreecommitdiffstats
path: root/include/openssl/lhash.h.in
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2022-04-25 10:50:36 -0700
committerPauli <pauli@openssl.org>2022-05-09 10:04:58 +1000
commiteab9dbbdd1f102dc1a26549a77fcc5c167385cd5 (patch)
treed56f6ec8748baecf686526fa4e0c198c4b28fc50 /include/openssl/lhash.h.in
parent4e720f12fade8d433e5a0eb3ead9017193dac6e7 (diff)
Header file cleanup for C++20 header-units
C++20 adds 'header units' as a stepping-stone to modules. Header units are regular header-files that have a 'self-contained' property -- they do not require previously-included headers to provide typedefs and what not. This addresses 2 problems discovered when using clang modules (as a proxy for C++20 header-units). a) Some headers that pay attention to OPENSSL_NO_STDIO to determine whether to declare certain FILE*-taking functions do not #include <stdio.h> themselves, relying on their includer already having done that. That breaks the above mentioned encapuslation requirement. Fixed by conditionally including stdio.h in those headers. I chose to always include stdio.h in such headers, even when they included another such header that transitively included stdio. That way they do not rely on an artifact of that intermediate header's behaviour. b) Some headers have #includes inside 'extern "C" { ... }' regions. That has a bad code-smell, but GCC and clang have extensions to permit it with implementation-defined effects. Clang needs annotation on the included files to know that they themselves are entirely inside a similar region. GCC behavesq as-if there's an extern "C++" region wrapping the included header (which must therefore wrap its contents in extern "C", if that is what it wants. In effect the includer's extern "C" region is just misleading. I didn't audit all the headers for this, only those I noticed when addressing #a. \#a is necessary to build the headers as a set of clang-modules. #b is not necessary, but as I mentioned, avoids potentially implementation-defined behaviour. Reviewed-by: Todd Short <todd.short@me.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18221)
Diffstat (limited to 'include/openssl/lhash.h.in')
-rw-r--r--include/openssl/lhash.h.in3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/openssl/lhash.h.in b/include/openssl/lhash.h.in
index febefa3c4a..e9bb2590a0 100644
--- a/include/openssl/lhash.h.in
+++ b/include/openssl/lhash.h.in
@@ -26,6 +26,9 @@ use OpenSSL::stackhash qw(generate_lhash_macros);
# include <openssl/e_os2.h>
# include <openssl/bio.h>
+# ifndef OPENSSL_NO_STDIO
+# include <stdio.h>
+# endif
#ifdef __cplusplus
extern "C" {