autoconf: Test Functions
1
1 6.2.2 Test Functions
1 --------------------
1
1 These days it's safe to assume support for function prototypes
1 (introduced in C89).
1
1 Functions that test programs declare should also be conditionalized
1 for C++, which requires `extern "C"' prototypes. Make sure to not
1 include any header files containing clashing prototypes.
1
1 #ifdef __cplusplus
1 extern "C"
1 #endif
1 void *valloc (size_t);
1
1 If a test program calls a function with invalid parameters (just to
1 see whether it exists), organize the program to ensure that it never
1 invokes that function. You can do this by calling it in another
1 function that is never invoked. You can't do it by putting it after a
1 call to `exit', because GCC version 2 knows that `exit' never returns
1 and optimizes out any code that follows it in the same block.
1
1 If you include any header files, be sure to call the functions
1 relevant to them with the correct number of arguments, even if they are
1 just 0, to avoid compilation errors due to prototypes. GCC version 2
1 has internal prototypes for several functions that it automatically
1 inlines; for example, `memcpy'. To avoid errors when checking for
1 them, either pass them the correct number of arguments or redeclare them
1 with a different return type (such as `char').
1