Skip site navigation (1)Skip section navigation (2)
Date:      Mon,  1 Jul 2002 18:49:10 +0200 (CEST)
From:      Stefan Farfeleder <e0026813@stud3.tuwien.ac.at>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        obrien@FreeBSD.org
Subject:   standards/40084: g++ complaining about redeclaration of wchar_t with -pedantic
Message-ID:  <20020701164910.BD0F1263@frog.fafoe>

next in thread | raw e-mail | index | archive | help

>Number:         40084
>Category:       standards
>Synopsis:       g++ complaining about redeclaration of wchar_t with -pedantic
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-standards
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 01 11:10:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Stefan Farfeleder
>Release:        FreeBSD 4.6-STABLE i386
>Organization:
>Environment:
System: FreeBSD frog.fafoe 4.6-STABLE FreeBSD 4.6-STABLE #9: Sat Jun 29 22:00:32 CEST 2002 root@frog.fafoe:/usr/obj/usr/src/sys/FROG i386
	
>Description:
With the update to gcc 2.95.4, code to distinguish system headers from others
was disabled in is_system_include(). As a consequence, warnings (only with
-pedantic) about wchar_t being redeclared (because wchar_t is builtin in C++)
aren't suppressed anymore.
	
>How-To-Repeat:
%cat wchar.cc
#include <cstddef>
int
main()
{ 
}
%g++ -ansi -pedantic -W -Wall wchar.cc
In file included from /usr/include/g++/cstddef:6,
                 from wchar.cc:1:
/usr/include/stddef.h:58: warning: redeclaration of wchar_t as `int'
	
>Fix:
One possible solution would be not to define _BSD_WCHAR_T_ in ansi.h when
compiling in C++ mode:

--- ansi.h.orig	Mon Jul  1 18:01:39 2002
+++ ansi.h	Mon Jul  1 18:03:45 2002
@@ -56,7 +56,10 @@
 #define	_BSD_SSIZE_T_	int			/* byte count or error */
 #define	_BSD_TIME_T_	long			/* time()... */
 #define	_BSD_TIMER_T_	int			/* timer_gettime()... */
+/* wchar_t is builtin in C++ */
+#ifndef __cplusplus 
 #define	_BSD_WCHAR_T_	_BSD_CT_RUNE_T_		/* wchar_t (see below) */
+#endif
 #define	_BSD_WINT_T_	_BSD_CT_RUNE_T_		/* wint_t (see below) */
 
 /*
	
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-standards" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020701164910.BD0F1263>