[GCC-XML] EXTERNAL: Re: error: unable to emulate 'TI'

Davidson, Josh josh.davidson at lmco.com
Mon Nov 7 17:24:07 EST 2011


Thanks that did clear up the error.  I did run into another oddity though, which I swear was working before.  When I attempt to run gccxml against a header file (courtesy of Py++), the gcc parser fails regardless if I'm using the MinGW or Cygwin build of gccxml.  Now, if I #include the header file in a simple C++ file, it works just fine.

C:\scratch>gccxml hello_world.hpp
gccxml_cc1plus.exe: internal compiler error: in c_common_valid_pch, at c-pch.c:2
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

// Copyright 2004-2006 Roman Yakovenko.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#ifndef __hello_world_hpp__
#define __hello_world_hpp__

#include <string>

//I want to rename color to Color
enum color{ red, green, blue };

struct genealogical_tree{/*...*/};

struct animal{
    explicit animal( const std::string& name="" )
    : m_name( name )
    //I need to set call policies to the function
    genealogical_tree& genealogical_tree_ref()
    { return m_genealogical_tree; }

    std::string name() const
    { return m_name; }
    std::string m_name;
    genealogical_tree m_genealogical_tree;

//I want to exclude next declarations:
struct impl1{};
struct impl2{};

inline int* get_int_ptr(){ return 0;}    
inline int* get_int_ptr(int){ return 0;}
inline int* get_int_ptr(double){ return 0;}

-------------------------------Working test.cpp---------------------------------
#include "hello_world.hpp"

int blah() {
   int e;
    return 0;

-----Original Message-----
From: Brad King [mailto:brad.king at kitware.com] 
Sent: Monday, November 07, 2011 2:36 PM
To: Davidson, Josh
Cc: gccxml at gccxml.org
Subject: EXTERNAL: Re: [GCC-XML] error: unable to emulate 'TI'

On 11/7/2011 2:14 PM, Davidson, Josh wrote:
> Just a little background...I'm using gccxml for Linux, Cygwin, and MinGW.
 > I know MinGW isn't officially supported (or at least didn't use to be),
 > but I've had no issues thus far with it.  That is, until I attempted to
 > get a 64-bit version working.  I was able to get gccxml built, but when
 > I run, I get the following error:
> C:\Users\davidsj2\scratch>gccxml test.cpp
> test.cpp:1: error: unable to emulate 'TI'
> c:/mingw64-i686-20110207/lib/gcc/../../x86_64-w64-mingw32/include/_mingw.h:194: error: unable to emulate 'TI'

I think this is because gccxml uses a GCC 4.2 parser internally that is
compiled for a 32-bit target.  It does not know how to handle the
__mode__(TI) attribute it sees in the MinGW header when preprocessed
for a 64-bit build.  I can produce the same error outside of gccxml
using just GCC for 32-bit MinGW:

  $ cat test.c
  typedef int int128 __attribute__ ((__mode__ (TI)));

  $ gcc --version
  gcc.exe (GCC) 4.5.2

  $ gcc -c test.c
  test.c:1:1: error: unable to emulate 'TI'

Since gccxml is interested only in the interface and not in the ABI
you may be able to work around the error by adding "-D__mode__(x)="
to the command line.  It works for the above error:

  $ gcc -c test.c "-D__mode__(x)="


More information about the gccxml mailing list