On 06/05/2013 03:16 PM, Christopher Sean Morrison wrote:
> getting past GCC's pedantic point about direct type conversion.

If the user tests with -Werror that warning could be a problem,
so that flag is worth stripping if possible.

Ideally we need a test that works with gcc flags

 -std=c99 -pedantic -Werror -O3

The only one I've found from some quick experiments requires
two source files:

 $ cat symbol_main.c
 #include <stdio.h> /* declares tested symbol */
 extern int cmakeRequireSymbol();
 int main(void) { return cmakeRequireSymbol(&printf); }

 $ cat symbol_impl.c
 int cmakeRequireSymbol(int* x) { return *x; }

 $ gcc -std=c99 -pedantic -Werror -O3 symbol_main.c symbol_impl.c

In this approach we hide the pointer conversion from the compiler.
If a compiler does whole-program optimization we could restore the
argc offset part.

-Brad
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to