yacc.c: provide the Bison version as an integral macro

Suggested by Balazs Scheidler.
https://github.com/akimd/bison/issues/55

* src/muscle-tab.c (muscle_init): Move/rename `b4_version` to/as...
* src/output.c (prepare): `b4_version_string`.
Also define `b4_version`.
* data/skeletons/bison.m4, data/skeletons/c.m4, data/skeletons/d.m4,
* data/skeletons/java.m4: Adjust.
* doc/bison.texi: Document it.
This commit is contained in:
Akim Demaille
2020-11-11 08:42:16 +01:00
parent d3c575a6c6
commit 21c147b6e5
9 changed files with 30 additions and 17 deletions

View File

@@ -127,9 +127,6 @@ muscle_init (void)
muscle_table = hash_xinitialize (HT_INITIAL_CAPACITY, NULL, hash_muscle,
hash_compare_muscles, muscle_entry_free);
/* Version and input file. */
MUSCLE_INSERT_STRING ("version", VERSION);
}

View File

@@ -42,6 +42,7 @@
#include "scan-skel.h"
#include "symtab.h"
#include "tables.h"
#include "strversion.h"
static struct obstack format_obstack;
@@ -807,6 +808,9 @@ prepare (void)
char const *cp = getenv ("BISON_USE_PUSH_FOR_PULL");
bool use_push_for_pull_flag = cp && *cp && strtol (cp, 0, 10);
/* Versions. */
MUSCLE_INSERT_STRING ("version_string", VERSION);
MUSCLE_INSERT_INT ("version", strversion_to_int (VERSION));
MUSCLE_INSERT_INT ("required_version", required_version);
/* Flags. */

View File

@@ -46,7 +46,7 @@
USER NAME SPACE" below. */
/* Identify Bison output. */
#define YYBISON 1
#define YYBISON 30703
/* Bison version. */
#define YYBISON_VERSION "3.7.3.7-d831b"