[ragel-users] compile issue on platforms with char being unsigned by default
thurston at colm.net
Tue Jan 22 03:38:43 UTC 2019
Thanks for the report Ralf. Part of a push of work that needs to be done
on cross compilation and types before 7.0 final.
On 2019-01-13 13:42, Ralf Hoffmann wrote:
> I got a report for a project of mine that compilation does not work on
> platforms where the C type "char" is unsigned by default. The problem
> within a file generated with ragel 22.214.171.124 (but 126.96.36.199 behaves the
> The array *trans_cond_spaces is of type const char but contains a lot
> of -1. This will lead to a compiler error: narrowing conversion of ‘-1’
> from ‘int’ to ‘char’ inside...
> I have attached a small (stripped-down) example which does not do
> anything useful but triggers the problem.
> Steps to reproduce:
> $ ragel test.rl -o test.cc
> $ g++ -funsigned-char test.cc -c
> g++ is 7.3.1.
> I don't want to compile a selected file with "-fsigned-char" and all
> the rest with the default behavior so my current workaround is to patch
> the array to be of type "signed char". Since this is the intended
> behavior anyway may I suggest to change the generated output to use
> signed char? I don't know if any of the other arrays may contain
> negative values as well.
> Feedback is very welcome, maybe there is also some other way around
> Best regards,
> ragel-users mailing list
> ragel-users at colm.net
More information about the ragel-users