shinh / elvm

EsoLangVM Compiler Infrastructure
MIT License
1.13k stars 143 forks source link

-Werror compatibility for newer versions of GCC #121

Closed woodrush closed 1 year ago

woodrush commented 2 years ago

Fixes #87. Currently, running make causes 8 errors from GCC due to warnings being applied as errors through the -Werror flag. I was able to reproduce the same errors mentioned in the image in #87.

All of the errors are -Werror=enum-conversion, where enums are implicitly casted to the enum Op.

This pull request fixes this by simply casting enums with the function's return type. Since all casts are enum-to-enum casts I think this is the safest solution.

I've tested this fix on the x86 backend. I've confirmed that all of the following tests, including the self-hosting test, runs successfully on my machine: