bison-patches
[Top][All Lists]
Advanced

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

Re: YYSTYPE_IS_TRIVIAL


From: Akim Demaille
Subject: Re: YYSTYPE_IS_TRIVIAL
Date: 23 Apr 2002 10:24:33 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp)

| > From: Akim Demaille <address@hidden>
| > Date: 22 Apr 2002 15:42:12 +0200
| > 
| > I think the patch should be applied to the head too, but of course we
| > can debate about it.  If you too think we should apply it, would you
| > do it?  I'm fine with tweaking it a bit afterwards if needed, and I'm
| > fine with helping you too.
| 
| OK, here's my first cut at trying to adapt the patches in:
| http://mail.gnu.org/pipermail/bison-patches/2002-March/000760.html
| 
| The main problem is that I haven't a clue as to what to do about those
| patches to reader.c.  I gather that I need to add a muscle, but I need
| something that will define YYSTYPE_IS_TRIVIAL only if the user does
| not define YYSTYPE.  In 1_29-branch I did this:
| 
|      const char *prologue = "\
|    #ifndef YYSTYPE\n\
|    typedef union";
|      const char *epilogue = "\
|     yystype;\n\
|    # define YYSTYPE yystype\n\
|    # define YYSTYPE_IS_TRIVIAL 1\n\
|    #endif\n";
|      ...
|      obstack_sgrow (&attrs_obstack, prologue);
|      [copy some stuff to attrs_obstack]
|      obstack_sgrow (&attrs_obstack, epilogue);
|   
| but I don't see how to get the same effect using muscles.

There is a global variable, named `typed'.  I would simply
MUSCLE_INSERT_INT ("stype_is_trivial", typed); in reader.c:prepare,
and in bison.simple, just use b4_stype_is_trivial with regular M4
macros.

It is up to you to use it to define a CPP macro, or to decide to use
M4 to decide what code should be output.  I believe the best would be
using M4, and if you share my opinion but don't want to adjust the
code to this end, just tell me, and leave it to me.

| I can merge the bison.simple part of the patch, as follows, and I
| think the following patch is an improvement (though I can't test this
| easily as the head has problems on my host as I discussed in an
| earlier message today).  However, by itself the patch below won't fix
| the C++-compiler-masquerading-as-C-compiler problem on the head.

Please, install!



reply via email to

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