aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-04-27 17:24:57 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-04-27 17:24:57 +0200
commit34286111363ca14aae81d50ab16732627425ef72 (patch)
tree5862221a980e92162380afa4fe31b86efdc5b54d
parent52793dc8860e38f725dc0ca8300c4e2ca9d4ceb9 (diff)
GCC 4.7 compatibility changes
-rw-r--r--odb/cxx-lexer.cxx19
-rw-r--r--odb/cxx-lexer.hxx7
-rw-r--r--odb/gcc.hxx8
-rw-r--r--odb/include.cxx29
-rw-r--r--odb/traversal/elements.hxx2
-rw-r--r--odb/traversal/relational/elements.hxx4
-rw-r--r--odb/traversal/relational/key.hxx2
7 files changed, 59 insertions, 12 deletions
diff --git a/odb/cxx-lexer.cxx b/odb/cxx-lexer.cxx
index 4766639..9a910aa 100644
--- a/odb/cxx-lexer.cxx
+++ b/odb/cxx-lexer.cxx
@@ -173,10 +173,23 @@ cxx_string_lexer ()
: reader_ (0)
{
linemap_init (&line_map_);
+
+#if BUILDING_GCC_MAJOR > 4 || BUILDING_GCC_MAJOR == 4 && BUILDING_GCC_MINOR > 6
+ line_map_.round_alloc_size = ggc_round_alloc_size;
+#endif
+
linemap_add (&line_map_, LC_ENTER, 0, "<memory>", 0);
reader_ = cpp_create_reader (
- cxx_dialect == cxx0x ? CLK_CXX0X : CLK_CXX98, 0, &line_map_);
+ cxx_dialect == cxx0x
+#if BUILDING_GCC_MAJOR > 4 || BUILDING_GCC_MAJOR == 4 && BUILDING_GCC_MINOR > 6
+ ? CLK_CXX11
+#else
+ ? CLK_CXX0X
+#endif
+ : CLK_CXX98,
+ 0,
+ &line_map_);
if (reader_ == 0)
throw bad_alloc ();
@@ -190,7 +203,11 @@ cxx_string_lexer::
if (reader_ != 0)
cpp_destroy (reader_);
+ // Was removed as "dead code" in GCC 4.7.0.
+ //
+#if BUILDING_GCC_MAJOR == 4 && BUILDING_GCC_MINOR <= 6
linemap_free (&line_map_);
+#endif
}
void cxx_string_lexer::
diff --git a/odb/cxx-lexer.hxx b/odb/cxx-lexer.hxx
index 11b6a35..e1e9fa5 100644
--- a/odb/cxx-lexer.hxx
+++ b/odb/cxx-lexer.hxx
@@ -11,9 +11,12 @@
#include <odb/cxx-token.hxx>
-// A C++ keyword. This is an extension to libcpp token types.
+// A C++ keyword. This is an extension to libcpp token types. GCC 4.7.0
+// adds this define.
//
-#define CPP_KEYWORD ((cpp_ttype) (N_TTYPES + 1))
+#if BUILDING_GCC_MAJOR == 4 && BUILDING_GCC_MINOR <= 6
+# define CPP_KEYWORD ((cpp_ttype) (N_TTYPES + 1))
+#endif
class cxx_lexer
{
diff --git a/odb/gcc.hxx b/odb/gcc.hxx
index da77027..3f9cd8c 100644
--- a/odb/gcc.hxx
+++ b/odb/gcc.hxx
@@ -16,8 +16,11 @@
#include <cstdlib> // Include before GCC poisons some declarations.
+#if BUILDING_GCC_MAJOR == 4 && BUILDING_GCC_MINOR <= 6
extern "C"
{
+#endif
+
#include <bversion.h>
#include <gcc-plugin.h>
@@ -43,7 +46,10 @@ extern "C"
#include <diagnostic.h>
#include <output.h>
-}
+
+#if BUILDING_GCC_MAJOR == 4 && BUILDING_GCC_MINOR <= 6
+} // extern "C"
+#endif
#ifndef LOCATION_COLUMN
#define LOCATION_COLUMN(LOC) (expand_location (LOC).column)
diff --git a/odb/include.cxx b/odb/include.cxx
index 7168b01..0cfe0ce 100644
--- a/odb/include.cxx
+++ b/odb/include.cxx
@@ -487,23 +487,36 @@ namespace include
// Add all the known include locations for each file in the map.
//
- for (size_t i (0); i < line_table->used; ++i)
+#if BUILDING_GCC_MAJOR == 4 && BUILDING_GCC_MINOR <= 6
+ size_t used (line_table->used);
+ line_map const* maps (line_table->maps);
+#else
+ size_t used (line_table->info_ordinary.used);
+ line_map const* maps (line_table->info_ordinary.maps);
+#endif
+
+ for (size_t i (0); i < used; ++i)
{
- line_map const* m (line_table->maps + i);
+ line_map const* m (maps + i);
if (MAIN_FILE_P (m) || m->reason != LC_ENTER)
continue;
- line_map const* i (INCLUDED_FROM (line_table, m));
+ line_map const* ifm (INCLUDED_FROM (line_table, m));
+#if BUILDING_GCC_MAJOR == 4 && BUILDING_GCC_MINOR <= 6
path f (m->to_file);
+#else
+ path f (ORDINARY_MAP_FILE_NAME (m));
+#endif
+
f.complete ();
f.normalize ();
include_map::iterator it (imap.find (f));
if (it != imap.end ())
- it->second[i] = include_directive ();
+ it->second[ifm] = include_directive ();
}
//
@@ -549,7 +562,11 @@ namespace include
if (main_lm != 0)
{
+#if BUILDING_GCC_MAJOR == 4 && BUILDING_GCC_MINOR <= 6
string f (main_lm->to_file);
+#else
+ string f (ORDINARY_MAP_FILE_NAME (main_lm));
+#endif
size_t n (f.size ());
// Check if this is a synthesized fragment.
@@ -573,7 +590,11 @@ namespace include
{
line_map const* lm (j->first);
+#if BUILDING_GCC_MAJOR == 4 && BUILDING_GCC_MINOR <= 6
string f (lm->to_file);
+#else
+ string f (ORDINARY_MAP_FILE_NAME (lm));
+#endif
size_t n (f.size ());
// Check if this is a synthesized fragment.
diff --git a/odb/traversal/elements.hxx b/odb/traversal/elements.hxx
index 967858f..c8ea80a 100644
--- a/odb/traversal/elements.hxx
+++ b/odb/traversal/elements.hxx
@@ -193,7 +193,7 @@ namespace traversal
virtual void
names (T& s, edge_dispatcher& d)
{
- iterate_and_dispatch (s.names_begin (), s.names_end (), d);
+ this->iterate_and_dispatch (s.names_begin (), s.names_end (), d);
}
};
diff --git a/odb/traversal/relational/elements.hxx b/odb/traversal/relational/elements.hxx
index 17abe7a..6699352 100644
--- a/odb/traversal/relational/elements.hxx
+++ b/odb/traversal/relational/elements.hxx
@@ -108,7 +108,7 @@ namespace traversal
virtual void
traverse (semantics::relational::names<N>& e)
{
- dispatch (e.nameable ());
+ this->dispatch (e.nameable ());
}
};
@@ -146,7 +146,7 @@ namespace traversal
virtual void
names (T& s, edge_dispatcher& d)
{
- iterate_and_dispatch (s.names_begin (), s.names_end (), d);
+ this->iterate_and_dispatch (s.names_begin (), s.names_end (), d);
}
};
diff --git a/odb/traversal/relational/key.hxx b/odb/traversal/relational/key.hxx
index f368349..551e543 100644
--- a/odb/traversal/relational/key.hxx
+++ b/odb/traversal/relational/key.hxx
@@ -31,7 +31,7 @@ namespace traversal
virtual void
contains (T& k, edge_dispatcher& d)
{
- iterate_and_dispatch (k.contains_begin (), k.contains_end (), d);
+ this->iterate_and_dispatch (k.contains_begin (), k.contains_end (), d);
}
};