You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "tuxji (via GitHub)" <gi...@apache.org> on 2023/11/20 20:41:41 UTC
[PR] Make code gen support EmptyGram [daffodil]
tuxji opened a new pull request, #1121:
URL: https://github.com/apache/daffodil/pull/1121
Fix the Daffodil C code generator to stop crashing on someone's private DFDL schema. Their schema is private and too large to include, but somehow it creates an EmptyGram object. Make sure the code gen recognizes the EmptyGram object instead of crashing when seeing it.
c/DaffodilCCodeGenerator.scala: Add clause to support EmptyGram.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make code gen support EmptyGram [daffodil]
Posted by "tuxji (via GitHub)" <gi...@apache.org>.
tuxji commented on code in PR #1121:
URL: https://github.com/apache/daffodil/pull/1121#discussion_r1399940515
##########
daffodil-codegen-c/src/main/scala/org/apache/daffodil/codegen/c/DaffodilCCodeGenerator.scala:
##########
@@ -275,6 +276,7 @@ object DaffodilCCodeGenerator
case g: ElementParseAndUnspecifiedLength =>
elementParseAndUnspecifiedLengthGenerateCode(g, cgState)
case g: ElementUnused => noop(g)
+ case g: Gram if g eq EmptyGram => noop(g)
Review Comment:
Thanks, I have improved the fix as suggested and added a new test case with a test schema containing an empty gram. Ready for review again.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make code gen support EmptyGram [daffodil]
Posted by "stevedlawrence (via GitHub)" <gi...@apache.org>.
stevedlawrence commented on code in PR #1121:
URL: https://github.com/apache/daffodil/pull/1121#discussion_r1399882186
##########
daffodil-codegen-c/src/main/scala/org/apache/daffodil/codegen/c/DaffodilCCodeGenerator.scala:
##########
@@ -275,6 +276,7 @@ object DaffodilCCodeGenerator
case g: ElementParseAndUnspecifiedLength =>
elementParseAndUnspecifiedLengthGenerateCode(g, cgState)
case g: ElementUnused => noop(g)
+ case g: Gram if g eq EmptyGram => noop(g)
Review Comment:
It might better to add this as the first case instead:
```scala
case g: Gram if g.isEmpty => noop(g)
```
This will still noop `EmptyGram`'s like you have, but also noop non-`EmptyGram` grammars that determine that they are empty. I'm not sure if it's possible for codgen-c to walk into those or if you'll only ever see empty grammars that are `EmptyGram`, but it wouldn't hurt.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make code gen support EmptyGram [daffodil]
Posted by "tuxji (via GitHub)" <gi...@apache.org>.
tuxji merged PR #1121:
URL: https://github.com/apache/daffodil/pull/1121
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org