public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/28975]  New: conflicting declaration 'typedef struct mbstate_t mbstate_t'
@ 2006-09-07 15:35 waspswarm at gmail dot com
  2006-09-07 15:39 ` [Bug c++/28975] " waspswarm at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: waspswarm at gmail dot com @ 2006-09-07 15:35 UTC (permalink / raw)
  To: gcc-bugs

When compiling the following test application with g++ and
-D__STDC_VERSION__=199901 I receive errors about duplicate declarations.

$ uname -a
HP-UX yellow B.11.23 U ia64 1794711014 unlimited-user license

// g++ -o test.o -g -O2 -mlp64 -D__STDC_VERSION__=199901 -c testmbstate.cpp
// remove -D__STDC_VERSION__=199901 and it compiles cleanly

#include <iostream>
int main(int argc, char** argv)
{
        return 0;
}

$ g++ -v -o test.o -g -O2 -mlp64 -D__STDC_VERSION__=199901 -c testmbsta>
Using built-in specs.
Target: ia64-hp-hpux11.23
Configured with: ../gcc-4.1.1/configure --enable-checking=release
--disable-shared --enable-threads=posix --disable-nls --enable-c99
--enable-languages=c,c++ : (reconfigured) ../gcc-4.1.1/configure
--enable-checking=release --disable-shared --enable-threads=posix --disable-nls
--enable-c99 --enable-languages=c,c++ --with-gnu-as
--with-as=/opt/hp-gcc/bin/as --without-gnu-ld
Thread model: posix
gcc version 4.1.1
 /usr/local/libexec/gcc/ia64-hp-hpux11.23/4.1.1/cc1plus -quiet -v
-D__STDC_VERSION__=199901 testmbstate.cpp -quiet -dumpbase testmbstate.cpp
-mlp64 -auxbase-strip test.o -g -O2 -version -o /var/tmp//ccLUuqb0.s
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory
"/usr/local/lib/gcc/ia64-hp-hpux11.23/4.1.1/../../../../ia64-hp-hpux11.23/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc/ia64-hp-hpux11.23/4.1.1/../../../../include/c++/4.1.1

/usr/local/lib/gcc/ia64-hp-hpux11.23/4.1.1/../../../../include/c++/4.1.1/ia64-hp-hpux11.23

/usr/local/lib/gcc/ia64-hp-hpux11.23/4.1.1/../../../../include/c++/4.1.1/backward
 /usr/local/include
 /usr/local/lib/gcc/ia64-hp-hpux11.23/4.1.1/include
 /usr/include
End of search list.
GNU C++ version 4.1.1 (ia64-hp-hpux11.23)
        compiled by GNU C version 3.4.6.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 8d13e28aaeb67511ccb5485a483e1cbb
/usr/local/lib/gcc/ia64-hp-hpux11.23/4.1.1/../../../../include/c++/4.1.1/cwchar:66:
error: conflicting declaration 'typedef struct mbstate_t mbstate_t'
/usr/include/sys/_mbstate_t.h:15: error: 'mbstate_t' has a previous declaration
as 'typedef struct mbstate_t mbstate_t'


-- 
           Summary: conflicting declaration 'typedef struct mbstate_t
                    mbstate_t'
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: waspswarm at gmail dot com
 GCC build triplet: ia64-hp-hpux11.23
  GCC host triplet: ia64-hp-hpux11.23
GCC target triplet: ia64-hp-hpux11.23


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28975


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/28975] conflicting declaration 'typedef struct mbstate_t mbstate_t'
  2006-09-07 15:35 [Bug c++/28975] New: conflicting declaration 'typedef struct mbstate_t mbstate_t' waspswarm at gmail dot com
@ 2006-09-07 15:39 ` waspswarm at gmail dot com
  2006-09-07 15:43 ` [Bug target/28975] " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: waspswarm at gmail dot com @ 2006-09-07 15:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from waspswarm at gmail dot com  2006-09-07 15:39 -------
Here is /usr/include/sys/_mbstate_t.h

/*
 * @(#)B11.23_LR
 */

#ifndef _MBSTATE_T_INCLUDED
#define _MBSTATE_T_INCLUDED

#  ifndef _MBSTATE_T
#     define _MBSTATE_T
      typedef struct {
         unsigned char __parse_size:3;
         unsigned char __dummy:4;
         unsigned char __shift_state:1;
         char __parse_buf[7];
      } mbstate_t;
#  endif

#endif /* _MBSTATE_T_INCLUDED */

Here is the section of /usr/local/include/c++/4.1.1/cwchar around line 66:
// Need to do a bit of trickery here with mbstate_t as char_traits
// assumes it is in wchar.h, regardless of wchar_t specializations.
#ifndef _GLIBCXX_HAVE_MBSTATE_T
extern "C"
{
  typedef struct
  {
    int __fill[6];
  } mbstate_t;
}
#endif

namespace std
{
  using ::mbstate_t;
}


-- 

waspswarm at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |waspswarm at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28975


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/28975] conflicting declaration 'typedef struct mbstate_t mbstate_t'
  2006-09-07 15:35 [Bug c++/28975] New: conflicting declaration 'typedef struct mbstate_t mbstate_t' waspswarm at gmail dot com
  2006-09-07 15:39 ` [Bug c++/28975] " waspswarm at gmail dot com
@ 2006-09-07 15:43 ` pinskia at gcc dot gnu dot org
  2006-09-07 15:46 ` waspswarm at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-07 15:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-09-07 15:42 -------
So that means when __STDC_VERSION__=199901  then _GLIBCXX_HAVE_MBSTATE_T needs
to be defined or something like that.

Anyways this is a target issue.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |target
  GCC build triplet|ia64-hp-hpux11.23           |
   GCC host triplet|ia64-hp-hpux11.23           |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28975


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/28975] conflicting declaration 'typedef struct mbstate_t mbstate_t'
  2006-09-07 15:35 [Bug c++/28975] New: conflicting declaration 'typedef struct mbstate_t mbstate_t' waspswarm at gmail dot com
  2006-09-07 15:39 ` [Bug c++/28975] " waspswarm at gmail dot com
  2006-09-07 15:43 ` [Bug target/28975] " pinskia at gcc dot gnu dot org
@ 2006-09-07 15:46 ` waspswarm at gmail dot com
  2006-09-13 21:08 ` sje at cup dot hp dot com
  2006-10-31 18:15 ` sje at cup dot hp dot com
  4 siblings, 0 replies; 6+ messages in thread
From: waspswarm at gmail dot com @ 2006-09-07 15:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from waspswarm at gmail dot com  2006-09-07 15:46 -------
(In reply to comment #2)
> So that means when __STDC_VERSION__=199901  then _GLIBCXX_HAVE_MBSTATE_T needs
> to be defined or something like that.
> 
> Anyways this is a target issue.
> 

Thanks!

Adding -D_GLIBCXX_HAVE_MBSTATE_T to the compile line gets around the error.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28975


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/28975] conflicting declaration 'typedef struct mbstate_t mbstate_t'
  2006-09-07 15:35 [Bug c++/28975] New: conflicting declaration 'typedef struct mbstate_t mbstate_t' waspswarm at gmail dot com
                   ` (2 preceding siblings ...)
  2006-09-07 15:46 ` waspswarm at gmail dot com
@ 2006-09-13 21:08 ` sje at cup dot hp dot com
  2006-10-31 18:15 ` sje at cup dot hp dot com
  4 siblings, 0 replies; 6+ messages in thread
From: sje at cup dot hp dot com @ 2006-09-13 21:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from sje at cup dot hp dot com  2006-09-13 21:08 -------
The underlying problem here is twofold, The C++ configure script will only
check for mbstate_t if wchar is enabled.  On IA64 HP-UX wchar is not enabled
because we are missing a define that makes the wchar type visible to g++.  Here
is a patch that will fix this problem.  I have not submitted it yet because we
are in regression only mode.

This patch will make wchar enabled and correctly set GLIBCXX_HAVE_MBSTATE_T.

The extra .o file that we link in is to make sure that we have the correct
unix98 behaviour for the C++ wide date functions and not the unix93 or unix95
behaviour.  The C++ testsuite will have regressions if we do not include it.


Index: config/ia64/hpux.h
===================================================================
--- config/ia64/hpux.h  (revision 116775)
+++ config/ia64/hpux.h  (working copy)
@@ -53,6 +53,7 @@ do {                                                  \
            builtin_define("_HPUX_SOURCE");             \
            builtin_define("__STDC_EXT__");             \
            builtin_define("__STDCPP__");               \
+           builtin_define("_INCLUDE__STDC_A1_SOURCE"); \
          }                                             \
        if (TARGET_ILP32)                               \
          builtin_define("_ILP32");                     \
@@ -71,7 +72,9 @@ do {                                                  \
 #undef ENDFILE_SPEC

 #undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{!shared:%{static:crt0%O%s}}"
+#define STARTFILE_SPEC "%{!shared:%{static:crt0%O%s} \
+                         %{mlp64:/usr/lib/hpux64/unix98%O%s} \
+                         %{!mlp64:/usr/lib/hpux32/unix98%O%s}}"

 #undef LINK_SPEC
 #define LINK_SPEC \


-- 

sje at cup dot hp dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sje at cup dot hp dot com
         AssignedTo|unassigned at gcc dot gnu   |sje at cup dot hp dot com
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-09-13 21:08:15
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28975


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/28975] conflicting declaration 'typedef struct mbstate_t mbstate_t'
  2006-09-07 15:35 [Bug c++/28975] New: conflicting declaration 'typedef struct mbstate_t mbstate_t' waspswarm at gmail dot com
                   ` (3 preceding siblings ...)
  2006-09-13 21:08 ` sje at cup dot hp dot com
@ 2006-10-31 18:15 ` sje at cup dot hp dot com
  4 siblings, 0 replies; 6+ messages in thread
From: sje at cup dot hp dot com @ 2006-10-31 18:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from sje at cup dot hp dot com  2006-10-31 18:15 -------
I forgot to include the PR number in my ChangeLog entry but this defect is
fixed with the patch in comment #4.  It has been backported to the 4.0, 4.1,
and 4.2 branches as well as being checked in on the ToT.


-- 

sje at cup dot hp dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28975


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-10-31 18:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-07 15:35 [Bug c++/28975] New: conflicting declaration 'typedef struct mbstate_t mbstate_t' waspswarm at gmail dot com
2006-09-07 15:39 ` [Bug c++/28975] " waspswarm at gmail dot com
2006-09-07 15:43 ` [Bug target/28975] " pinskia at gcc dot gnu dot org
2006-09-07 15:46 ` waspswarm at gmail dot com
2006-09-13 21:08 ` sje at cup dot hp dot com
2006-10-31 18:15 ` sje at cup dot hp dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).