From 91bbf4219d2bfce3720dd194796f62f2103d40e3 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 16 Mar 2019 08:46:52 +0100 Subject: [PATCH] simplify the generated #line Currently we generate things like: #line 683 "src/parse-gram.y" /* yacc.c:316 */ The first part is of course very important: compilers point the users to their grammar file rather than into the generated parser. The second part points to the place in the skeletons that generated this piece of code. This dependency on the Bison skeletons generates lots of useless 'git diff'. This location is useless for the regular user (who does not care about the skeletons) and is actually not useful for Bison developpers too (I never used this to locate the code in skeletons that generated output). So disable it completely. If someone thinks this was actually useful, a %define variable should be provided to control the level of verbosity of '#line', in replacement of --no-lines. So now, generate: #line 683 "src/parse-gram.y" * data/skeletons/bison.m4 (b4_sync_end): Emit nothing. --- data/skeletons/bison.m4 | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/data/skeletons/bison.m4 b/data/skeletons/bison.m4 index e3591875..cefe6a91 100644 --- a/data/skeletons/bison.m4 +++ b/data/skeletons/bison.m4 @@ -588,10 +588,11 @@ m4_define([b4_basename], # b4_syncline(LINE, FILE) # ----------------------- +# Emit "#line LINE FILE /* __LINE__ __FILE__ */". m4_define([b4_syncline], [b4_flag_if([synclines], -[b4_sync_start([$1], [$2]) b4_sync_end([__line__], - [b4_basename(m4_quote(__file__))])[]dnl +[b4_sync_start([$1], [$2])[]dnl +b4_sync_end([__line__], [b4_basename(m4_quote(__file__))])[]dnl ])]) # b4_sync_start(LINE, FILE) @@ -603,7 +604,17 @@ m4_define([b4_sync_start], [b4_comment([$2:$1])]) # ----------------------- # Syncline for the current place, which ends. Typically a comment # left for the reader. -m4_define([b4_sync_end], [b4_comment([$2:$1])]) +m4_define([b4_sync_end], [ b4_comment([$2:$1])] +) +# This generates dependencies on the Bison skeletons hence lots of +# useless 'git diff'. This location is useless for the regular +# user (who does not care about the skeletons) and is actually not +# useful for Bison developpers too (I, Akim, never used this to locate +# the code in skeletons that generated output). So disable it +# completely. If someone thinks this was actually useful, a %define +# variable should be provided to control the level of verbosity of +# '#line', in replacement of --no-lines. +m4_define([b4_sync_end]) # b4_user_code(USER-CODE)