]> git.ipfire.org Git - thirdparty/openssl.git/blame - test/testutil/output.h
Avoid more MSVC-specific C runtime library functions
[thirdparty/openssl.git] / test / testutil / output.h
CommitLineData
579d0fab 1/*
fbd2ece1 2 * Copyright 2014-2020 The OpenSSL Project Authors. All Rights Reserved.
579d0fab 3 *
909f1a2e 4 * Licensed under the Apache License 2.0 (the "License"). You may not use
579d0fab
RL
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
ae4186b0
DMSP
10#ifndef OSSL_TESTUTIL_OUTPUT_H
11# define OSSL_TESTUTIL_OUTPUT_H
579d0fab 12
ec91206f 13# include <stdarg.h>
579d0fab 14
ec91206f
CZ
15# define ossl_test__attr__(x)
16# if defined(__GNUC__) && defined(__STDC_VERSION__) \
17 && !defined(__APPLE__)
18 /*
19 * Because we support the 'z' modifier, which made its appearance in C99,
20 * we can't use __attribute__ with pre C99 dialects.
21 */
22# if __STDC_VERSION__ >= 199901L
23# undef ossl_test__attr__
24# define ossl_test__attr__ __attribute__
25# if __GNUC__*10 + __GNUC_MINOR__ >= 44
26# define ossl_test__printf__ __gnu_printf__
27# else
28# define ossl_test__printf__ __printf__
29# endif
30# endif
31# endif
579d0fab
RL
32/*
33 * The basic I/O functions used internally by the test framework. These
46f4e1be 34 * can be overridden when needed. Note that if one is, then all must be.
579d0fab
RL
35 */
36void test_open_streams(void);
37void test_close_streams(void);
8dce4aa2 38void test_adjust_streams_tap_level(int level);
579d0fab 39/* The following ALL return the number of characters written */
ec91206f
CZ
40int test_vprintf_stdout(const char *fmt, va_list ap)
41 ossl_test__attr__((__format__(ossl_test__printf__, 1, 0)));
8dce4aa2
RL
42int test_vprintf_tapout(const char *fmt, va_list ap)
43 ossl_test__attr__((__format__(ossl_test__printf__, 1, 0)));
ec91206f
CZ
44int test_vprintf_stderr(const char *fmt, va_list ap)
45 ossl_test__attr__((__format__(ossl_test__printf__, 1, 0)));
8dce4aa2
RL
46int test_vprintf_taperr(const char *fmt, va_list ap)
47 ossl_test__attr__((__format__(ossl_test__printf__, 1, 0)));
579d0fab
RL
48/* These return failure or success */
49int test_flush_stdout(void);
8dce4aa2 50int test_flush_tapout(void);
579d0fab 51int test_flush_stderr(void);
8dce4aa2 52int test_flush_taperr(void);
579d0fab 53
603ddbdb 54/* Commodity functions. There's no need to override these */
ec91206f
CZ
55int test_printf_stdout(const char *fmt, ...)
56 ossl_test__attr__((__format__(ossl_test__printf__, 1, 2)));
8dce4aa2
RL
57int test_printf_tapout(const char *fmt, ...)
58 ossl_test__attr__((__format__(ossl_test__printf__, 1, 2)));
ec91206f
CZ
59int test_printf_stderr(const char *fmt, ...)
60 ossl_test__attr__((__format__(ossl_test__printf__, 1, 2)));
8dce4aa2
RL
61int test_printf_taperr(const char *fmt, ...)
62 ossl_test__attr__((__format__(ossl_test__printf__, 1, 2)));
ec91206f
CZ
63
64# undef ossl_test__printf__
65# undef ossl_test__attr__
603ddbdb 66
ae4186b0 67#endif /* OSSL_TESTUTIL_OUTPUT_H */