[esnacc-dev] [PATCH] Improved error reporting for SEQUENCE tags - added fieldName that caused the error

Aaron Conole aconole at bytheb.org
Fri Jul 22 03:42:24 UTC 2016


Charles Wright <charles_wright at azimuthsystems.com> writes:

> ---
>  compiler/back-ends/c++-gen/gen-code.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/compiler/back-ends/c++-gen/gen-code.c b/compiler/back-ends/c++-gen/gen-code.c
> index 444bc8d..f8a091c 100644
> --- a/compiler/back-ends/c++-gen/gen-code.c
> +++ b/compiler/back-ends/c++-gen/gen-code.c
> @@ -2742,7 +2742,7 @@ PrintCxxSeqDefCode (FILE *src, FILE *hdr, ModuleList *mods, Module *m,
>                      }
>                      else
>                      {
> -                        fprintf (src, "      throw EXCEPT(\"SEQUENCE is missing non-optional root elmt\", DECODE_ERROR);\n");
> +                        fprintf (src, "      throw EXCEPT(\"SEQUENCE is missing non-optional root elmt (%s)\", DECODE_ERROR);\n", e->fieldName);
>                      }
>                      fprintf (src, "  }\n\n");
>                  }

Thanks for your contribution.  I rewrote your commit message as follows:

    compiler/c++-gen: Improved error reporting for SEQUENCE tags

    This commit adds an additional output which includes the fieldName
    that caused the error.

    Signed-off-by: Charles Wright <charles_wright at azimuthsystems.com>


And I reformatted your code as follows, and applied to master.

-Aaron

---
diff --git a/compiler/back-ends/c++-gen/gen-code.c b/compiler/back-ends/c++-gen/gen-code.c
index 444bc8d..6809858 100644
--- a/compiler/back-ends/c++-gen/gen-code.c
+++ b/compiler/back-ends/c++-gen/gen-code.c
@@ -2742,7 +2742,9 @@ PrintCxxSeqDefCode (FILE *src, FILE *hdr, ModuleList *mods, Module *m,
                     }
                     else
                     {
-                        fprintf (src, "      throw EXCEPT(\"SEQUENCE is missing non-optional root elmt\", DECODE_ERROR);\n");
+                        fprintf (src,
+                                 "      throw EXCEPT(\"SEQUENCE is missing non-optional root elmt (%s)\", DECODE_ERROR);\n",
+                                 e->fieldName);
                     }
                     fprintf (src, "  }\n\n");
                 }



More information about the dev mailing list