-]])
-
-
-# Declare yyerror.
-m4_append([b4_post_prologue],
-[/* Line __line__ of glr.cc. */
-b4_syncline([@oline@], [@ofile@])
-
-b4_c_ansi_function_decl([yyerror],
- [static void],
- [[b4_namespace::b4_parser_class_name::location_type *yylocationp], [yylocationp]],
+]])[
+
+# Hijack the initial action to initialize the locations.
+]b4_bison_locations_if([m4_define([b4_initial_action],
+[yylloc.initialize ();]m4_ifdef([b4_initial_action], [
+m4_defn([b4_initial_action])]))])[
+
+# Hijack the post prologue to insert early definition of YYLLOC_DEFAULT
+# and declaration of yyerror.
+]m4_append([b4_post_prologue],
+[b4_syncline([@oline@], [@ofile@])[
+]b4_yylloc_default_define[
+#define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
+]b4_function_declare([yyerror],
+ [static void],b4_locations_if([
+ [[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
+ [yylocationp]],])