error: cannot combine with previous 'type-name' declaration specifier

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

error: cannot combine with previous 'type-name' declaration specifier

Sascha Wildner
Hi,

encouraged by the recent improvement in clang's C++ support, I tried
building DragonFly's devd(8) with it but am getting:

clang -fno-color-diagnostics   -O -pipe  -I.
-I/home/s/projects/dragonfly/src/sbin/devd  -g  -c devd.cc
In file included from devd.cc:59:
In file included from /usr/include/c++/4.1/algorithm:64:
In file included from /usr/include/c++/4.1/bits/stl_algobase.h:69:
In file included from /usr/include/c++/4.1/iosfwd:48:
In file included from /usr/include/c++/4.1/bits/postypes.h:45:
In file included from /usr/include/c++/4.1/cwchar:54:
/usr/include/wchar.h:78:19: error: cannot combine with previous
'type-name' declaration specifier
typedef __wchar_t       wchar_t;
                         ^
/usr/include/wchar.h:78:1: error: declaration does not declare anything
typedef __wchar_t       wchar_t;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 diagnostics generated.
*** Error code 1

But what is the problem here?

Regards,
Sascha
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: error: cannot combine with previous 'type-name' declaration specifier

Douglas Gregor

On Jan 11, 2010, at 12:44 PM, Sascha Wildner wrote:

> Hi,
>
> encouraged by the recent improvement in clang's C++ support, I tried
> building DragonFly's devd(8) with it but am getting:
>
> clang -fno-color-diagnostics   -O -pipe  -I.
> -I/home/s/projects/dragonfly/src/sbin/devd  -g  -c devd.cc
> In file included from devd.cc:59:
> In file included from /usr/include/c++/4.1/algorithm:64:
> In file included from /usr/include/c++/4.1/bits/stl_algobase.h:69:
> In file included from /usr/include/c++/4.1/iosfwd:48:
> In file included from /usr/include/c++/4.1/bits/postypes.h:45:
> In file included from /usr/include/c++/4.1/cwchar:54:
> /usr/include/wchar.h:78:19: error: cannot combine with previous
> 'type-name' declaration specifier
> typedef __wchar_t       wchar_t;
>                         ^
> /usr/include/wchar.h:78:1: error: declaration does not declare  
> anything
> typedef __wchar_t       wchar_t;
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 2 diagnostics generated.
> *** Error code 1
>
> But what is the problem here?


The wchar.h header looks suspicious. wchar_t is a built-in type in C+
+, and cannot be a typedef.  Somehow, your wchar.h should protect  
against defining wchar_t when in C++ mode. I suggest looking through /
usr/include/wchar.h to determine which preprocessor macros control  
that definition.

        - Doug
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: error: cannot combine with previous 'type-name' declaration specifier

Sean Hunt
In reply to this post by Sascha Wildner
On Mon, Jan 11, 2010 at 1:44 PM, Sascha Wildner <[hidden email]> wrote:

> Hi,
>
> encouraged by the recent improvement in clang's C++ support, I tried
> building DragonFly's devd(8) with it but am getting:
>
> clang -fno-color-diagnostics   -O -pipe  -I.
> -I/home/s/projects/dragonfly/src/sbin/devd  -g  -c devd.cc
> In file included from devd.cc:59:
> In file included from /usr/include/c++/4.1/algorithm:64:
> In file included from /usr/include/c++/4.1/bits/stl_algobase.h:69:
> In file included from /usr/include/c++/4.1/iosfwd:48:
> In file included from /usr/include/c++/4.1/bits/postypes.h:45:
> In file included from /usr/include/c++/4.1/cwchar:54:
> /usr/include/wchar.h:78:19: error: cannot combine with previous
> 'type-name' declaration specifier
> typedef __wchar_t       wchar_t;
>                         ^
> /usr/include/wchar.h:78:1: error: declaration does not declare anything
> typedef __wchar_t       wchar_t;
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 2 diagnostics generated.
> *** Error code 1
>
> But what is the problem here?
>
> Regards,
> Sascha

wchar_t is a built-in type specifier and it looks like that libstdc++
version, old as it is, is not checking for this, so it's like trying
to typedef __int int; which obviously won't work.

Perhaps this is another place where we special-case a typedef rule to
support older versions of libstdc++?

Sean

P.S. This message was orinally sent directly to Sascha; I still have
not gotten a hang of this list. Sorry for the duplicate, Sascha!

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: error: cannot combine with previous 'type-name' declaration specifier

Eli Friedman
In reply to this post by Sascha Wildner
On Mon, Jan 11, 2010 at 12:44 PM, Sascha Wildner <[hidden email]> wrote:

> Hi,
>
> encouraged by the recent improvement in clang's C++ support, I tried
> building DragonFly's devd(8) with it but am getting:
>
> clang -fno-color-diagnostics   -O -pipe  -I.
> -I/home/s/projects/dragonfly/src/sbin/devd  -g  -c devd.cc
> In file included from devd.cc:59:
> In file included from /usr/include/c++/4.1/algorithm:64:
> In file included from /usr/include/c++/4.1/bits/stl_algobase.h:69:
> In file included from /usr/include/c++/4.1/iosfwd:48:
> In file included from /usr/include/c++/4.1/bits/postypes.h:45:
> In file included from /usr/include/c++/4.1/cwchar:54:
> /usr/include/wchar.h:78:19: error: cannot combine with previous
> 'type-name' declaration specifier
> typedef __wchar_t       wchar_t;
>                         ^
> /usr/include/wchar.h:78:1: error: declaration does not declare anything
> typedef __wchar_t       wchar_t;
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 2 diagnostics generated.
> *** Error code 1
>
> But what is the problem here?

It appears Dragonfly BSD expects stddef.h to define _WCHAR_T_DECLARED,
which doesn't happen in clang at the moment.

-Eli

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: error: cannot combine with previous 'type-name' declaration specifier

Sascha Wildner
In reply to this post by Douglas Gregor
Am 11.01.2010 21:53, schrieb Douglas Gregor:

>
> On Jan 11, 2010, at 12:44 PM, Sascha Wildner wrote:
>
>> /usr/include/wchar.h:78:19: error: cannot combine with previous
>> 'type-name' declaration specifier
>> typedef __wchar_t       wchar_t;
>>                          ^
>> /usr/include/wchar.h:78:1: error: declaration does not declare
>> anything
>> typedef __wchar_t       wchar_t;
>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> 2 diagnostics generated.
>> *** Error code 1
>>
>> But what is the problem here?
>
>
> The wchar.h header looks suspicious. wchar_t is a built-in type in C+
> +, and cannot be a typedef.  Somehow, your wchar.h should protect
> against defining wchar_t when in C++ mode. I suggest looking through /
> usr/include/wchar.h to determine which preprocessor macros control
> that definition.

It turned out we didn't have #ifndef __cplusplus around our wchar_t
typedef in wchar.h. With this being added, it at least gets through
compilation but fails linking. I'm investigating currently and will get
back in case I found something.

Just one note: gcc obviously doesn't have a problem with this (typedef
wchar_t in C++). I've tried clang with -std=gnu++98 (gcc's default
setting) but it didn't make a difference. Not sure if that qualifies as
a "gcc compatibility bug" or so.

Thanks to all who answered,
Sascha
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: error: cannot combine with previous 'type-name' declaration specifier

Sascha Wildner
Am 13.01.2010 05:16, schrieb Sascha Wildner:
> Just one note: gcc obviously doesn't have a problem with this (typedef
> wchar_t in C++). I've tried clang with -std=gnu++98 (gcc's default
> setting) but it didn't make a difference. Not sure if that qualifies as
> a "gcc compatibility bug" or so.

I'm sorry, my testing was wrong there, g++ errors just the same.

Sascha
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: error: cannot combine with previous 'type-name' declaration specifier

Edward O'Callaghan
Hi Sascha,

Not sure here however on some systems you need to define wchar_t
builtin as part of the toolchain support, here is a *example* for
DragonflyBSD,

Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp (revision 93303)
+++ lib/Basic/Targets.cpp (working copy)
@@ -189,7 +189,9 @@
   }
 public:
   DragonFlyBSDTargetInfo(const std::string &triple)
-    : OSTargetInfo<Target>(triple) {}
+    : OSTargetInfo<Target>(triple) {
+    this->WCharType = this->SignedLong; //Is this correct?
+  }
 };

 // FreeBSD Target


Maybe this will set you on the correct path to a workable solution,
Hope this is helpful in some way.
Cheers,
Edward.

2010/1/13 Sascha Wildner <[hidden email]>:

> Am 13.01.2010 05:16, schrieb Sascha Wildner:
>> Just one note: gcc obviously doesn't have a problem with this (typedef
>> wchar_t in C++). I've tried clang with -std=gnu++98 (gcc's default
>> setting) but it didn't make a difference. Not sure if that qualifies as
>> a "gcc compatibility bug" or so.
>
> I'm sorry, my testing was wrong there, g++ errors just the same.
>
> Sascha
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>



--
--
Edward O'Callaghan
http://www.auroraux.org/
eocallaghan at auroraux dot org
---
()  ascii ribbon campaign - against html e-mail
/\                        - against microsoft attachments
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev