• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2019 The BoringSSL Authors
2  *
3  * Permission to use, copy, modify, and/or distribute this software for any
4  * purpose with or without fee is hereby granted, provided that the above
5  * copyright notice and this permission notice appear in all copies.
6  *
7  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14 
15 #include <openssl/ssl.h>
16 
17 int BORINGSSL_enum_c_type_test(void);
18 
BORINGSSL_enum_c_type_test(void)19 int BORINGSSL_enum_c_type_test(void) {
20 #if defined(__cplusplus)
21 #error "This is testing the behaviour of the C compiler."
22 #error "It's pointless to build it in C++ mode."
23 #endif
24 
25   // In C++, the enums in ssl.h are explicitly typed as ints to allow them to
26   // be predeclared. This function confirms that the C compiler believes them
27   // to be the same size as ints. They may differ in signedness, however.
28   return sizeof(enum ssl_private_key_result_t) == sizeof(int);
29 }
30