1#!/bin/sh 2# 3# This script is used to generate the source files for this test. 4# 5LIMITS="" 6CONSTANTS="" 7for SIZE in 8 16 32 64; do 8 for PREFIX in INT INT_LEAST INT_FAST; do 9 LIMITS="$LIMITS $PREFIX${SIZE}_MIN $PREFIX${SIZE}_MAX" 10 CONSTANTS="$CONSTANTS $PREFIX${SIZE}_C" 11 done 12 for PREFIX in UINT UINT_LEAST UINT_FAST; do 13 LIMITS="$LIMITS $PREFIX${SIZE}_MAX" 14 CONSTANTS="$CONSTANTS $PREFIX${SIZE}_C" 15 done 16done 17 18LIMITS="$LIMITS INTMAX_MIN INTMAX_MAX UINTMAX_MAX" 19CONSTANTS="$CONSTANTS INTMAX_C UINTMAX_C" 20 21for PREFIX in INTPTR PTRDIFF; do 22 LIMITS="$LIMITS ${PREFIX}_MIN ${PREFIX}_MAX" 23 CONSTANTS="$CONSTANTS ${PREFIX}_C" 24done 25 26LIMITS="$LIMITS UINTPTR_MAX" 27CONSTANTS="$CONSTANTS UINTPTR_C" 28 29SRC=test_cpp_no_macros.cpp 30 31gen_cpp_no_macros () 32{ 33 echo "/* AUTO-GENERATED FILE - DO NOT MODIFY! */" 34 echo "#include <android/api-level.h>" 35 echo "#if __ANDROID_API__ < 20" 36 echo "#include <stdint.h>" 37 for MACRO in $LIMITS $CONSTANTS; do 38 echo "#ifdef $MACRO" 39 echo "#error $MACRO defined!" 40 echo "#endif" 41 done 42 echo "#endif" 43} 44 45gen_cpp_limit_macros () 46{ 47 echo "/* AUTO-GENERATED FILE - DO NOT MODIFY! */" 48 echo "#define __STDC_LIMIT_MACROS 1" 49 echo "#include <android/api-level.h>" 50 echo "#include <stdint.h>" 51 for MACRO in $LIMITS; do 52 echo "#ifndef $MACRO" 53 echo "#error $MACRO is not defined!" 54 echo "#endif" 55 done 56 echo "#if __ANDROID_API__ < 20" 57 for MACRO in $CONSTANTS; do 58 echo "#ifdef $MACRO" 59 echo "#error $MACRO is defined!" 60 echo "#endif" 61 done 62 echo "#endif" 63} 64 65gen_cpp_constant_macros () 66{ 67 echo "/* AUTO-GENERATED FILE - DO NOT MODIFY! */" 68 echo "#define __STDC_CONSTANT_MACROS 1" 69 echo "#include <android/api-level.h>" 70 echo "#include <stdint.h>" 71 echo "#if __ANDROID_API__ < 20" 72 for MACRO in $LIMITS; do 73 echo "#ifdef $MACRO" 74 echo "#error $MACRO is defined!" 75 echo "#endif" 76 done 77 echo "#endif" 78 for MACRO in $CONSTANTS; do 79 echo "#ifndef $MACRO" 80 echo "#error $MACRO is not defined!" 81 echo "#endif" 82 done 83} 84 85gen_cpp_all_macros () 86{ 87 echo "/* AUTO-GENERATED FILE - DO NOT MODIFY! */" 88 echo "#define __STDC_LIMIT_MACROS 1" 89 echo "#define __STDC_CONSTANT_MACROS 1" 90 echo "#include <stdint.h>" 91 for MACRO in $LIMITS $CONSTANTS; do 92 echo "#ifndef $MACRO" 93 echo "#error $MACRO defined!" 94 echo "#endif" 95 done 96} 97 98gen_c () 99{ 100 echo "/* AUTO-GENERATED FILE - DO NOT MODIFY! */" 101 echo "#include <stdint.h>" 102 for MACRO in $LIMITS $CONSTANTS; do 103 echo "#ifndef $MACRO" 104 echo "#error $MACRO defined!" 105 echo "#endif" 106 done 107} 108 109gen_c > test_c.c 110gen_cpp_no_macros > test_no_macros.cpp 111gen_cpp_limit_macros > test_limit_macros.cpp 112gen_cpp_constant_macros > test_constant_macros.cpp 113gen_cpp_all_macros > test_all_macros.cpp 114