Skip to content

Commit

Permalink
add prelude checks
Browse files Browse the repository at this point in the history
  • Loading branch information
camshaft committed Oct 28, 2024
1 parent 177519e commit 5ddd4c0
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/features/S2N_MADVISE_SUPPORTED.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* permissions and limitations under the License.
*/

#include "utils/s2n_fork_detection_internal.h"
#include "utils/s2n_fork_detection_features.h"

int main() {
madvise(NULL, 0, 0);
Expand Down
2 changes: 1 addition & 1 deletion tests/features/S2N_MINHERIT_SUPPORTED.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* permissions and limitations under the License.
*/

#include "utils/s2n_fork_detection_internal.h"
#include "utils/s2n_fork_detection_features.h"

int main() {
minherit(NULL, 0, 0);
Expand Down
6 changes: 6 additions & 0 deletions tests/unit/s2n_build_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

#ifndef _S2N_PRELUDE_INCLUDED
/* make sure s2n_prelude.h is includes as part of the compiler flags, if not then fail the build */
#error "Expected s2n_prelude.h to be included as part of the compiler flags"
#endif

#define _GNU_SOURCE
#include <ctype.h>
#include <openssl/crypto.h>
Expand Down
5 changes: 5 additions & 0 deletions tls/s2n_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
* permissions and limitations under the License.
*/

#ifndef _S2N_PRELUDE_INCLUDED
/* make sure s2n_prelude.h is includes as part of the compiler flags, if not then fail the build */
#error "Expected s2n_prelude.h to be included as part of the compiler flags"
#endif

#include <strings.h>
#include <time.h>

Expand Down
2 changes: 1 addition & 1 deletion utils/s2n_fork_detection.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

/* force the internal header to be included first, since it modifies _GNU_SOURCE/_POSIX_C_SOURCE */
/* clang-format off */
#include "utils/s2n_fork_detection_internal.h"
#include "utils/s2n_fork_detection_features.h"
/* clang-format on */

#include "utils/s2n_fork_detection.h"
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions utils/s2n_prelude.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

#pragma once

/* Let modules know that the prelude was included */
#define _S2N_PRELUDE_INCLUDED

/* Define the POSIX API we are targeting */
#ifndef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200809L
Expand Down

0 comments on commit 5ddd4c0

Please sign in to comment.