1 /*
2 * Copyright (C) 2009 The Android Open Source Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the
13 * distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29 #include <cstdio>
30 #if defined BIONIC && !defined BIONIC_LIBSTDCPP_INCLUDE_CSTDIO__
31 #error "Wrong header file included!!"
32 #endif
33
34 namespace {
35 const int kPassed = 0;
36 const int kFailed = 1;
37 #define FAIL_UNLESS(f) if (!android::f()) return kFailed;
38 } // anonymous namespace
39
40 namespace android
41 {
42 #ifndef BUFSIZ
43 #error "BUFSIZ must be a macro"
44 #endif
45
46 #ifndef EOF
47 #error "EOF must be a macro"
48 #endif
49
50 #ifndef FILENAME_MAX
51 #error "FILENAME_MAX must be a macro"
52 #endif
53
54 #ifndef FOPEN_MAX
55 #error "FOPEN_MAX must be a macro"
56 #endif
57
58 #ifndef L_tmpnam
59 #error "L_tmpnam must be a macro"
60 #endif
61
62 #ifndef NULL
63 #error "NULL must be a macro"
64 #endif
65
66 #ifndef SEEK_CUR
67 #error "SEEK_CUR must be a macro"
68 #endif
69
70 #ifndef SEEK_END
71 #error "SEEK_END must be a macro"
72 #endif
73 #ifndef SEEK_SET
74 #error "SEEK_SET must be a macro"
75 #endif
76
77 #ifndef TMP_MAX
78 #error "TMP_MAX must be a macro"
79 #endif
80
81 #ifndef _IOFBF
82 #error "_IOFBF must be a macro"
83 #endif
84
85 #ifndef _IOLBF
86 #error "_IOLBF must be a macro"
87 #endif
88
89 #ifndef _IONBF
90 #error "_IONBF must be a macro"
91 #endif
92
93 #ifndef stderr
94 #error "stderr must be a macro"
95 #endif
96
97 #ifndef stdin
98 #error "stdin must be a macro"
99 #endif
100
101 #ifndef stdout
102 #error "stdout must be a macro"
103 #endif
104
105 using std::clearerr;
106 using std::fclose;
107 using std::feof;
108 using std::ferror;
109 using std::fflush;
110 using std::fgetc;
111 using std::fgetpos;
112 using std::fgets;
113 using std::fopen;
114 using std::fprintf;
115 using std::fputc;
116 using std::fputs;
117 using std::fread;
118 using std::freopen;
119 using std::fscanf;
120 using std::fseek;
121 using std::fsetpos;
122 using std::ftell;
123 using std::fwrite;
124 using std::getc;
125 using std::getchar;
126 using std::gets;
127 using std::perror;
128 using std::printf;
129 using std::putc;
130 using std::putchar;
131 using std::puts;
132 using std::remove;
133 using std::rename;
134 using std::rewind;
135 using std::scanf;
136 using std::setbuf;
137 using std::setvbuf;
138 using std::sprintf;
139 using std::sscanf;
140 using std::tmpfile;
141 using std::tmpnam;
142 using std::ungetc;
143 using std::vfprintf;
144 using std::vprintf;
145 using std::vsprintf;
146
147 using std::snprintf;
148 using std::vfscanf;
149 using std::vscanf;
150 using std::vsnprintf;
151 using std::vsscanf;
152
testTypesStd()153 bool testTypesStd()
154 {
155 volatile std::size_t size;
156 volatile std::FILE file;
157 volatile std::fpos_t fpos_t;
158 return true;
159 }
160 } // namespace android
161
main(int argc,char ** argv)162 int main(int argc, char **argv)
163 {
164 FAIL_UNLESS(testTypesStd);
165 return kPassed;
166 }
167