lalr1.cc: don't generate location.hh when location_type is defined

* data/bison.m4 (b4_percent_define_get): Accept a default value.
	* data/c++.m4: Do not provide a default value for the %define
	variable location_type, rather, use b4_percent_define_get with a
	default argument where its value is needed.
	* data/lalr1.cc: Do not load location.cc (which outputs both
	location.hh and position.hh) if the user defined location_type.
	Do not include location.hh either.
This commit is contained in:
Akim Demaille
2010-04-14 17:56:38 +02:00
parent 19ad326be4
commit 7789b6e3e7
4 changed files with 33 additions and 12 deletions

View File

@@ -124,10 +124,10 @@ m4_define([b4_parser_class_name],
b4_defines_if([],
[b4_fatal([b4_skeleton[: using %%defines is mandatory]])])
b4_locations_if(
[# Backward compatibility.
m4_define([b4_location_constructors])
m4_include(b4_pkgdatadir/[location.cc])])
b4_locations_if([b4_percent_define_ifdef([[location_type]], [],
[# Backward compatibility.
m4_define([b4_location_constructors])
m4_include(b4_pkgdatadir/[location.cc])])])
m4_include(b4_pkgdatadir/[stack.hh])
b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])])
@@ -149,8 +149,9 @@ dnl FIXME: This is wrong, we want computed header guards.
#include <stdexcept>
#include <string>
#include <iostream>
]b4_locations_if([#include "location.hh"])[
#include "stack.hh"
]b4_locations_if([b4_percent_define_ifdef([[location_type]], [],
[[#include "location.hh"]])])[
]b4_variant_if([b4_namespace_open
b4_variant_define