List of the Tests with short descritions. 2. May 2004 RF ***************************************** Test Sort Short Description ============================================================================= mintest00 . uninitialized variable mintest01 . unused variable mintest02 . no return type mintest03 . = instead of == (in an if-statement) mintest04 . == instead of = (statement "a==b;") mintest05 . shift and add without braces ("(b< 256) with 8-bit char). mintest024 # # and ## in simple use. mintest025 . (too much) {}-braces around scalar initializer mintest026 . unused variables ("extern char foo;" and others) mintest027 . invalid preprocessor declaration ("#define D define") and "#error" mintest028 * no newline at end of file. Caution: indent correts this! mintest029 * backslash-newline at end of file. Caution: indent corrects this! mintest030 # line without effect ("#") and case sensitivity (int i, I) mintest031 # use of qualifier restrict and comma operator mintest032 # calculation of structure size, example from the ANSI/ISO-Standard mintest033 * main defined as inline function mintest034 # use of malloc and memset mintest035 + including complex.h, float.h, iso646.h, limits.h, stdarg.h, stdbool.h, stddef.h, stdint.h. mintest036 * scanf() errors: wrong format, wrong argument mintest037 * Not using prototype/implicit declaration of function mintest038 . Not initializing pointers mintest039 . Wrong initialisation of character, wrong initialisaton of char pointer. mintest040 # Only including of all standard headers. Must work with every ANSI/ISO C implementation. mintest090 . access behind the end of an array mintest091 . infinit loop ("for(;;);" without warning) mintest092 . not thread save ("p = strtok(buf1, " "); q = strtok(buf2, " "); mintest093 . not easy and fast to read and understand code ("if (a++ > a)", "if ((a++) > a)" would be better and a warning due to the initializer for a would be best) mintest094 . local and global defined varialbe (simple side effect) ------------------------------------------------------------------------------ .: In all probability semantic error, should produce an error/warning message. #: Maybe uncommon but correct ANSI-C code (even for freestanding implementation), MUST produce NO error message. *: Syntax error (not ANSI-C), MUST produce a warning/error message. +: Usual feature. Test Results (with all warnings/errors enabled): ************************************************ Test Nr. gcc 3.3.1 ICC430 1.26A ICC430 2.20A MS-Visual C++ 5.0 ================================================================================= 0 + o + o 1 + + + + 2 + o o o 3 + o o o 4 + o + o 5 + o o o 6 + o o o 7 + + + + 8 + o + o 9 + + o o 10 + o o o 11 + o o o 12 + o o o 13 + o o o 14 + + + o 15 + o + + 16 + + + + 17 + o o + 18 + o + + 19 + o + + 20 + o + o 21 + o + + 22 + + + o 23 + o o o 24 + + + + 25 + o + o 26 + o* o o 27 + + + + 28 + o o o 29 + + + o 30 + + + + 31 +** o o + 32 + o + o 33 + + + + 34 + + + + 35 + o o o 36 + o 37 + + 38 + o 39 + + + 40 + o o 90 o o o 91 o + o 92 o o o 93 o o o 94 o o o ----------------------------------------------------------------------------- Average Score 41/46 15/46 21/41 15/38 Errors/bugs (*, #) 0 6 1 4 ============================================================================== Remarks: + = passed (nessisary error/warning produced or correct code produces no message), o = failed (nessisary warning/error missing or correct code produces a wrong message) *: Not all unused variables are not reported but unused main arguments do produce a warning. **: requires command line option --std=c99 gcc = GNU C Compiler. A very good but not perfect compiler, see tests 90, 91 .... Other unesthetic but rarely seen properties are: Unused main arguments (int argc, char ** argv) do not produce a warning, correct ANSI trigraph sequences produce a warning like "warning: trigraph ??= converted to #" with the option -ansi and the sequence is ignored without (but with warning and error), the qualifier restrict needs to be defined with "#define restrict __restrict__", math.h functions do need the linker option -lm. Derivates like the MSPGCC (for MSP430 plattform) should give (nearly) the same test results ICC430 = C Copiler from the IAR Embedded Workbech (an IDE which has no semantic checker, no prettyprinter, no revision control system, no cross-reference generator, no shell, no shrouder ...). Version 1.26A needs wrong paths for including in subdirectories (e. g. "inc/header.h" instead of "header.h" in in a header file which is in the same inc directory), does not know how to sprintf %hu or %u and has other little bugs like "save all" does not save the project file, write access to the project file occurs even when the project was unchanged. MS-Visual C++ 5.0 is a C++ compiler. todo: ===== * Test: The order in which the preprocessor concatenations operators # and ## are evalueated during macro substitution are undefined in ANSI/ISO-C => an appropriate warning should be produced from the preprocessor. * Initialisations (chapter 6.7) and other code examples from the standard ( e. g. http://www.ucalgary.ca/~bgwong/n869.pdf). * Conversion of (some parts) of the ggc-testsuite for freestanding implementaions. * Check of the C99 features (see http://gcc.gnu.org/c99status.html) because C99 replaces and CANCELS the older ANSI/ISO C standards (e. g. C89). * typedef void (*fn_t)(void); fn_t fns[128]; * test if a "defualt" (instead of the usual "default") lable is accepted in a case statement without a warning * calculations with variable length arrays. * Rest of the Annex I (Common Warnings) of the standard. * Example code from the "Rationale for International Standard Programming Languages C"