BNFC / bnfc

BNF Converter
http://bnfc.digitalgrammars.com/
586 stars 165 forks source link

C backend assumes that user of header file includes `stdio.h` #381

Closed enedil closed 3 years ago

enedil commented 3 years ago

In the C backend, none of the generated headers include any header from standard library. This is wrong, as Parser.h uses FILE*, which is defined in stdio.h. Thus, stdio.h should be also included.

BNFC version that I use: 2.9.1. OS: Fedora 34 BNFC distribution: stack

andreasabel commented 3 years ago

Thanks for reporting and the PR, @enedil! Is this also a problem with the C++ backends?

enedil commented 3 years ago

Thanks for reporting and the PR, @enedil! Is this also a problem with the C++ backends?

It doesn't, since Parser.H includes vector and string, which transitively usually include lots of other standard headers. But that is not guaranteed. I can make this addition as well. Latest forced push also fixes the C++ version.

andreasabel commented 3 years ago

Thanks @enedil, this is now fixed on master.