Re: [CMake] CHECK_FUNCTION_EXISTS and -Werror

2008-12-06 Thread Mathieu Malaterre
On Fri, Dec 5, 2008 at 12:27 PM, Mathieu Malaterre
[EMAIL PROTECTED] wrote:
 On Fri, Dec 5, 2008 at 12:12 PM, Eric Noulard [EMAIL PROTECTED] wrote:
 2008/12/5 Mathieu Malaterre [EMAIL PROTECTED]:
 'lo there,

  I had my CFLAGS set to -Werror, and because of that a try compile failed 
 with:

 [...]
 /usr/share/cmake-2.6/Modules/CheckFunctionExists.c:3: warning:
 conflicting types for built-in function 'strncasecmp'


  Does this means strncasecmp is some kinf of function known by the
 gcc compiler ?

 It should comes from  #include string.h
 and not from gcc itself but I may be wrong...

 Ok that's a builtin function since gcc 4.1 (at least).

 http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Other-Builtins.html



Would it make sense to prepend: -fno-builtin when gcc is detected ?

Thanks
-- 
Mathieu


Ref:
-fno-builtin
   -fno-builtin-function
   Don't recognize built-in functions that do not begin with
__builtin_ as prefix.

   GCC normally generates special code to handle certain
built-in functions more efficiently; for instance, calls to alloca
may become single instructions that adjust the stack directly, and
calls to memcpy may become
   inline copy loops.  The resulting code is often both
smaller and faster, but since the function calls no longer appear as
such, you cannot set a breakpoint on those calls, nor can you change
the behavior of the
   functions by linking with a different library.  In
addition, when a function is recognized as a built-in function, GCC
may use information about that function to warn about problems with
calls to that function, or to
   generate more efficient code, even if the resulting code
still contains calls to that function.  For example, warnings are
given with -Wformat for bad calls to printf, when printf is built
in, and strlen is known
   not to modify global memory.

   With the -fno-builtin-function option only the built-in
function function is disabled.  function must not begin with
__builtin_.  If a function is named this is not built-in in this
version of GCC, this option is
   ignored.  There is no corresponding -fbuiltin-function
option; if you wish to enable built-in functions selectively when
using -fno-builtin or -ffreestanding, you may define macros such as:

   #define abs(n)  __builtin_abs ((n))
   #define strcpy(d, s)__builtin_strcpy ((d), (s))
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] CHECK_FUNCTION_EXISTS and -Werror

2008-12-06 Thread Mathieu Malaterre
On Sat, Dec 6, 2008 at 11:20 AM, Mathieu Malaterre
[EMAIL PROTECTED] wrote:
 On Fri, Dec 5, 2008 at 12:27 PM, Mathieu Malaterre
 [EMAIL PROTECTED] wrote:
 On Fri, Dec 5, 2008 at 12:12 PM, Eric Noulard [EMAIL PROTECTED] wrote:
 2008/12/5 Mathieu Malaterre [EMAIL PROTECTED]:
 'lo there,

  I had my CFLAGS set to -Werror, and because of that a try compile failed 
 with:

 [...]
 /usr/share/cmake-2.6/Modules/CheckFunctionExists.c:3: warning:
 conflicting types for built-in function 'strncasecmp'


  Does this means strncasecmp is some kinf of function known by the
 gcc compiler ?

 It should comes from  #include string.h
 and not from gcc itself but I may be wrong...

 Ok that's a builtin function since gcc 4.1 (at least).

 http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Other-Builtins.html



 Would it make sense to prepend: -fno-builtin when gcc is detected ?

 Thanks
 --
 Mathieu


 Ref:
-fno-builtin
   -fno-builtin-function
   Don't recognize built-in functions that do not begin with
 __builtin_ as prefix.

   GCC normally generates special code to handle certain
 built-in functions more efficiently; for instance, calls to alloca
 may become single instructions that adjust the stack directly, and
 calls to memcpy may become
   inline copy loops.  The resulting code is often both
 smaller and faster, but since the function calls no longer appear as
 such, you cannot set a breakpoint on those calls, nor can you change
 the behavior of the
   functions by linking with a different library.  In
 addition, when a function is recognized as a built-in function, GCC
 may use information about that function to warn about problems with
 calls to that function, or to
   generate more efficient code, even if the resulting code
 still contains calls to that function.  For example, warnings are
 given with -Wformat for bad calls to printf, when printf is built
 in, and strlen is known
   not to modify global memory.

   With the -fno-builtin-function option only the built-in
 function function is disabled.  function must not begin with
 __builtin_.  If a function is named this is not built-in in this
 version of GCC, this option is
   ignored.  There is no corresponding -fbuiltin-function
 option; if you wish to enable built-in functions selectively when
 using -fno-builtin or -ffreestanding, you may define macros such as:

   #define abs(n)  __builtin_abs ((n))
   #define strcpy(d, s)__builtin_strcpy ((d), (s))


Logged:
http://cmake.org/Bug/view.php?id=8246

Thx
-- 
Mathieu
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


[CMake] CHECK_FUNCTION_EXISTS and -Werror

2008-12-05 Thread Mathieu Malaterre
'lo there,

  I had my CFLAGS set to -Werror, and because of that a try compile failed with:

Run Build Command:/usr/bin/make cmTryCompileExec/fast
/usr/bin/make -f CMakeFiles/cmTryCompileExec.dir/build.make
CMakeFiles/cmTryCompileExec.dir/build
make[1]: Entering directory
`/home/mmalaterre/Projects/gdcm/foo/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report
/home/mmalaterre/Projects/gdcm/foo/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec.dir/CheckFunctionExists.c.o
/usr/bin/gcc   -Werror   -DCHECK_FUNCTION_EXISTS=strncasecmp   -o
CMakeFiles/cmTryCompileExec.dir/CheckFunctionExists.c.o   -c
/usr/share/cmake-2.6/Modules/CheckFunctionExists.c
cc1: warnings being treated as errors
/usr/share/cmake-2.6/Modules/CheckFunctionExists.c:3: warning:
conflicting types for built-in function 'strncasecmp'
make[1]: *** [CMakeFiles/cmTryCompileExec.dir/CheckFunctionExists.c.o] Error 1
make[1]: Leaving directory
`/home/mmalaterre/Projects/gdcm/foo/CMakeFiles/CMakeTmp'
make: *** [cmTryCompileExec/fast] Error 2


  Does this means strncasecmp is some kinf of function known by the
gcc compiler ?

Thanks
-Mathieu
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] CHECK_FUNCTION_EXISTS and -Werror

2008-12-05 Thread Eric Noulard
2008/12/5 Mathieu Malaterre [EMAIL PROTECTED]:
 'lo there,

  I had my CFLAGS set to -Werror, and because of that a try compile failed 
 with:

[...]
 /usr/share/cmake-2.6/Modules/CheckFunctionExists.c:3: warning:
 conflicting types for built-in function 'strncasecmp'


  Does this means strncasecmp is some kinf of function known by the
 gcc compiler ?

It should comes from  #include string.h
and not from gcc itself but I may be wrong...





-- 
Erk
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] CHECK_FUNCTION_EXISTS and -Werror

2008-12-05 Thread Mathieu Malaterre
On Fri, Dec 5, 2008 at 12:12 PM, Eric Noulard [EMAIL PROTECTED] wrote:
 2008/12/5 Mathieu Malaterre [EMAIL PROTECTED]:
 'lo there,

  I had my CFLAGS set to -Werror, and because of that a try compile failed 
 with:

 [...]
 /usr/share/cmake-2.6/Modules/CheckFunctionExists.c:3: warning:
 conflicting types for built-in function 'strncasecmp'


  Does this means strncasecmp is some kinf of function known by the
 gcc compiler ?

 It should comes from  #include string.h
 and not from gcc itself but I may be wrong...

Ok that's a builtin function since gcc 4.1 (at least).

http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Other-Builtins.html

-- 
Mathieu
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake