[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using "%define location_type" c++ skeleton should exclude default locati

From: Chris Morley
Subject: Using "%define location_type" c++ skeleton should exclude default location
Date: Tue, 23 Mar 2010 08:14:18 -0000

Hi All,

I use Bison to generate a C++ parser using the lalr1 skeleton. I also use a custom location class.

I just upgraded a project from using v2.3.1 to v2.4.2 and as I am on Windows <windows.h> defines a max macro which breaks std::max now used in the 2.4.2 location.hh.

In itself not much of a problem but it made me realise that the default "location.hh" & forward decls of class location & position are included in the src.hpp regardless of a manual "%define location_type" in the yy file. IMO these should really be omitted if a custom location class is in use...

I never used m4 before but modified the in v2.4.2 as follows to achieve this. It is not pretty as I couldn't determine how to tell if the user has defined "location_type" rather than the default - thus is a dependency between this & the c++.m4

I don't use GLR, but it seems that the has the same code (line 236+).

Chris Morley

--- >8 ------ >8 ------ >8 ------ >8 ------ >8 ------ >8 ------ >8 ------ >8 ------ >8 ------ >8 ------ >8 ------ >8 ------ >8 ------ >8 ---

--- C:\cygwin\usr\share\bison\  2010-03-23 07:58:56.000000000 -0000
+++ C:\cygwin\usr\src\bison-2.4.2\data\ 2010-02-25 04:56:42.000000000 -0000
@@ -45,21 +45,18 @@

#include <string>
#include <iostream>
#include "stack.hh"

-]m4_if( b4_percent_define_get(location_type), location, [
  class position;
  class location;

#include "location.hh"
-, /*default location not included*/)[

/* Enabling traces.  */
#ifndef YYDEBUG
# define YYDEBUG ]b4_debug_flag[

reply via email to

[Prev in Thread] Current Thread [Next in Thread]