Re: clang and configure checking for equivalent simple type

2011-09-29 Thread Klaus T. Aehlig

Hi,

 Are you sure that you don't have -Werror being set somehow? 

well, fortunately I have! Note that it is a feature in this
context that a similar programs don't compile if the types
are incompatible.

Compare the following. -Wno-unused -Werror is indeed the
correct choice of flags.

Best,
Klaus


/usr/ports/net/socatmake configure CC=gcc
...
checking for equivalent simple type of size_t... 6 /* unsigned long */
checking for equivalent simple type of mode_t... 2 /* unsigned short */
checking for equivalent simple type of pid_t... 3 /* int */
checking for equivalent simple type of uid_t... 4 /* unsigned int */
checking for equivalent simple type of gid_t... 4 /* unsigned int */
checking for equivalent simple type of time_t... 5 /* long */
checking for equivalent simple type of socklen_t... 4 /* unsigned int */
checking for equivalent simple type of off_t... 5 /* long */
checking for equivalent simple type of off64_t... 0 /* unknown, taking default 
*/
checking for basic type of struct stat.st_dev... 4 /* unsigned int */
checking for basic type of struct stat.st_ino... 4 /* unsigned int */
checking for basic type of struct stat.st_nlink... 2 /* unsigned short */
checking for basic type of struct stat.st_size... 5 /* long */
checking for basic type of struct stat.st_blksize... 4 /* unsigned int */
checking for basic type of struct stat.st_blocks... 5 /* long */
checking for basic type of struct timeval.tv_usec... 5 /* long */
checking for basic type of struct rlimit.rlim_max... 5 /* long */
...

/usr/ports/net/socatmake configure CC=clang CFLAGS=-Wno-error
...
checking for equivalent simple type of size_t... 1 /* short */
checking for equivalent simple type of mode_t... 1 /* short */
checking for equivalent simple type of pid_t... 1 /* short */
checking for equivalent simple type of uid_t... 1 /* short */
checking for equivalent simple type of gid_t... 1 /* short */
checking for equivalent simple type of time_t... 1 /* short */
checking for equivalent simple type of socklen_t... 1 /* short */
checking for equivalent simple type of off_t... 1 /* short */
checking for equivalent simple type of off64_t... 0 /* unknown, taking default 
*/
checking for basic type of struct stat.st_dev... 1 /* short */
checking for basic type of struct stat.st_ino... 1 /* short */
checking for basic type of struct stat.st_nlink... 1 /* short */
checking for basic type of struct stat.st_size... 1 /* short */
checking for basic type of struct stat.st_blksize... 1 /* short */
checking for basic type of struct stat.st_blocks... 1 /* short */
checking for basic type of struct timeval.tv_usec... 1 /* short */
checking for basic type of struct rlimit.rlim_max... 1 /* short */
...

/usr/ports/net/socatmake configure CC=clang CFLAGS=-Wno-unused
...
checking for equivalent simple type of size_t... 6 /* unsigned long */
checking for equivalent simple type of mode_t... 2 /* unsigned short */
checking for equivalent simple type of pid_t... 3 /* int */
checking for equivalent simple type of uid_t... 4 /* unsigned int */
checking for equivalent simple type of gid_t... 4 /* unsigned int */
checking for equivalent simple type of time_t... 5 /* long */
checking for equivalent simple type of socklen_t... 4 /* unsigned int */
checking for equivalent simple type of off_t... 5 /* long */
checking for equivalent simple type of off64_t... 0 /* unknown, taking default 
*/
checking for basic type of struct stat.st_dev... 4 /* unsigned int */
checking for basic type of struct stat.st_ino... 4 /* unsigned int */
checking for basic type of struct stat.st_nlink... 2 /* unsigned short */
checking for basic type of struct stat.st_size... 5 /* long */
checking for basic type of struct stat.st_blksize... 4 /* unsigned int */
checking for basic type of struct stat.st_blocks... 5 /* long */
checking for basic type of struct timeval.tv_usec... 5 /* long */
checking for basic type of struct rlimit.rlim_max... 5 /* long */
...

/usr/ports/net/socatmake configure CC=clang CFLAGS=
...
checking for equivalent simple type of size_t... 0 /* unknown, taking default */
checking for equivalent simple type of mode_t... 0 /* unknown, taking default */
checking for equivalent simple type of pid_t... 0 /* unknown, taking default */
checking for equivalent simple type of uid_t... 0 /* unknown, taking default */
checking for equivalent simple type of gid_t... 0 /* unknown, taking default */
checking for equivalent simple type of time_t... 0 /* unknown, taking default */
checking for equivalent simple type of socklen_t... 0 /* unknown, taking 
default */
checking for equivalent simple type of off_t... 0 /* unknown, taking default */
checking for equivalent simple type of off64_t... 0 /* unknown, taking default 
*/
checking for basic type of struct stat.st_dev... 0 /* unknown, taking default */
checking for basic type of struct stat.st_ino... 0 /* unknown, taking default */
checking for basic type of struct stat.st_nlink... 0 /* unknown, taking default 
*/
checking for basic type 

Re: clang and configure checking for equivalent simple type

2011-09-29 Thread Klaus T. Aehlig

Hi,

 Alternatively, you can turn off only a specific -Werror, e.g.
 
   CFLAGS += -Wno-error=unused
 
 it's ignored by gcc in base while gcc46 wants -Wno-error=unused-value

that's a very good point. Thanks a lot!

Best,
Klaus

___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


clang and configure checking for equivalent simple type

2011-09-28 Thread Klaus T. Aehlig

Hallo,

while trying to find out why I couldn't build net/socat with clang
I found something that might be a general issue, and I wonder what
appropriate actions would be.

Trying 'cd /usr/ports/net/socat  make CC=clang' failed for me and
it turned out that the reason was that the configure script could
not find out the 'equivalent simple type of off_t'. Looking at the
configure script, one notes that it tries code snippets like

#include sys/types.h
#include unistd.h
int
main ()
{
off_t u; long v; u==v;
  ;
  return 0;
}

and check for compile errors. However, the above program is rejected
by clang, as the value u==v is unused, which, of course, has nothing
to do with the intended check whether off_t * and long * are compatible
pointer.

Adding

CFLAGS+= -Wno-unused 

solves this problem.

However, I assume that these kind of tests are quite widespread in configure
scripts, so I wonder what to do about this. Possible options include

- adding 'CFLAGS+= -Wno-unused' just for this port

- do nothing, but recommend users to have -Wno-unused in CFLAGS when using clang
  (maybe somewhere in the handbook)

- check with portmgr@ if adding -Wno-unused to the default CFLAGS (for clang?)
  is an option

- something completely different?? 
  (like: add an appropriate entry to my /etc/make.conf and don't care)

Any suggestions? 

Best,
Klaus

___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: clang and configure checking for equivalent simple type

2011-09-28 Thread Chuck Swiger
Hi--

On Sep 28, 2011, at 9:58 PM, Klaus T. Aehlig wrote:
 However, I assume that these kind of tests are quite widespread in configure
 scripts, so I wonder what to do about this. Possible options include
 
 - adding 'CFLAGS+= -Wno-unused' just for this port
 
 - do nothing, but recommend users to have -Wno-unused in CFLAGS when using 
 clang
  (maybe somewhere in the handbook)
 
 - check with portmgr@ if adding -Wno-unused to the default CFLAGS (for clang?)
  is an option
 
 - something completely different?? 
  (like: add an appropriate entry to my /etc/make.conf and don't care)
 
 Any suggestions? 

Are you sure that you don't have -Werror being set somehow?  I don't have a 
FreeBSD-9 system handy at the moment, but that code ought to compile under 
clang (with warnings, sure, but the result runs):

% clang -o t t.c
t.c:6:20: warning: comparison of distinct pointer types ('off_t *' (aka 'long 
long *') and 'long *')
off_t u; long v; u==v;
 ~~^ ~~
t.c:6:20: warning: expression result unused [-Wunused-value]
off_t u; long v; u==v;
 ~~^ ~~
2 warnings generated.
% ./t ; echo $?
0
% clang --version
Apple clang version 2.0 (tags/Apple/clang-137) (based on LLVM 2.9svn)

Regards,
-- 
-Chuck

___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org