boringssl/include/openssl
David Benjamin a943613e40 Inline functions are apparently really complicated.
C and C++ handle inline functions differently. In C++, an inline function is
defined in just the header file, potentially emitted in multiple compilation
units (in cases the compiler did not inline), but each copy must be identical
to satsify ODR. In C, a non-static inline must be manually emitted in exactly
one compilation unit with a separate extern inline declaration.

In both languages, exported inline functions referencing file-local symbols are
problematic. C forbids this altogether (though GCC and Clang seem not to
enforce it). It works in C++, but ODR requires the definitions be identical,
including all names in the definitions resolving to the "same entity". In
practice, this is unlikely to be a problem, but an inline function that returns
a pointer to a file-local symbol could compile oddly.

Historically, we used static inline in headers. However, to satisfy ODR, use
plain inline in C++, to allow inline consumer functions to call our header
functions. Plain inline would also work better with C99 inline, but that is not
used much in practice, extern inline is tedious, and there are conflicts with
the old gnu89 model: https://stackoverflow.com/questions/216510/extern-inline

For dual C/C++ code, use a macro to dispatch between these. For C++-only
code, stop using static inline and just use plain inline.

Update-Note: If you see weird C++ compile or link failures in header
    functions, this change is probably to blame. Though this change
    doesn't affect C and non-static inline is extremely common in C++,
    so I would expect this to be fine.

Change-Id: Ibb0bf8ff57143fc14e10342854e467f85a5e4a82
Reviewed-on: https://boringssl-review.googlesource.com/32116
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
Reviewed-by: Adam Langley <agl@google.com>
2018-10-01 22:57:00 +00:00
..
aead.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
aes.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
arm_arch.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
asn1_mac.h
asn1.h Rewrite PEM_X509_INFO_read_bio. 2018-10-01 17:35:10 +00:00
asn1t.h Remove ASN1_template_(i2d,d2i). 2017-09-15 22:53:43 +00:00
base64.h Document alternative functions to BIO_f_base64. 2018-09-07 15:58:12 +00:00
base.h Inline functions are apparently really complicated. 2018-10-01 22:57:00 +00:00
bio.h Fix undefined function pointer casts in {d2i,i2d}_Foo_{bio,fp} 2018-10-01 17:34:53 +00:00
blowfish.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
bn.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
buf.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
buffer.h
bytestring.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
cast.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
chacha.h Add chacha.h to the list of documented headers. 2017-10-12 15:27:34 +00:00
cipher.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
cmac.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
conf.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
cpu.h Inline functions are apparently really complicated. 2018-10-01 22:57:00 +00:00
crypto.h Add a pile of compatibility functions. 2018-08-13 23:13:26 +00:00
curve25519.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
des.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
dh.h Add missing bssl::UpRef overloads. 2018-09-14 16:45:54 +00:00
digest.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
dsa.h Add missing bssl::UpRef overloads. 2018-09-14 16:45:54 +00:00
dtls1.h
e_os2.h Add a stub e_os2.h header. 2018-05-08 01:32:14 +00:00
ec_key.h Add missing bssl::UpRef overloads. 2018-09-14 16:45:54 +00:00
ec.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
ecdh.h Add ECDH_compute_key_fips inside the module. 2018-07-30 22:40:31 +00:00
ecdsa.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
engine.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
err.h Add some more compatibility functions. 2018-05-08 20:51:15 +00:00
evp.h Make symbol-prefixing work on ARM. 2018-09-07 17:43:05 +00:00
ex_data.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
hkdf.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
hmac.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
is_boringssl.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
lhash_macros.h Add lh_FOO_retrieve_key to avoid stack-allocating SSL_SESSION. 2018-07-03 22:56:46 +00:00
lhash.h Add lh_FOO_retrieve_key to avoid stack-allocating SSL_SESSION. 2018-07-03 22:56:46 +00:00
md4.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
md5.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
mem.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
nid.h Add OpenSSL 1.1.0's cipher property functions. 2017-08-11 02:08:58 +00:00
obj_mac.h
obj.h Add some more compatibility functions. 2018-05-08 20:51:15 +00:00
objects.h
opensslconf.h Switch OPENSSL_VERSION_NUMBER to 1.1.0. 2017-09-29 04:51:27 +00:00
opensslv.h
ossl_typ.h
pem.h Fix undefined function pointer casts in IMPLEMENT_PEM_*. 2018-10-01 17:34:44 +00:00
pkcs7.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
pkcs8.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
pkcs12.h
poly1305.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
pool.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
rand.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
rc4.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
ripemd.h Run comment conversion script on include/ 2017-08-18 23:38:51 +00:00
rsa.h Add missing bssl::UpRef overloads. 2018-09-14 16:45:54 +00:00
safestack.h
sha.h Remove SHA384_Transform from sha.h. 2018-09-20 14:57:36 +00:00
span.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
srtp.h
ssl3.h Preliminary support for compressed certificates. 2018-06-04 21:24:20 +00:00
ssl.h Support symbol prefixes 2018-09-06 20:07:52 +00:00
stack.h Inline functions are apparently really complicated. 2018-10-01 22:57:00 +00:00
thread.h Rename OPENSSL_NO_THREADS, part 1. 2018-09-26 19:10:02 +00:00
tls1.h Update TLS 1.3 citations for the final RFC. 2018-08-16 18:37:50 +00:00
type_check.h Fix undefined function pointer casts in {d2i,i2d}_Foo_{bio,fp} 2018-10-01 17:34:53 +00:00
x509_vfy.h Don't accept “SSL client” as a substitute for S/MIME in the Netscape cert type extension. 2018-08-06 21:52:28 +00:00
x509.h Push an error on sigalg mismatch in X509_verify. 2018-09-19 03:44:50 +00:00
x509v3.h Support symbol prefixes 2018-09-06 20:07:52 +00:00