-fno-signed-char ignored

I use the -fno-signed-char command line option but it has no effect: CHAR_MIN is not zero but -128 and I get warnings like

warning: implicit conversion changes signedness: 'const char' to
      'wchar_t' (aka 'unsigned short') [-Wsign-conversion]
                        while(*cs) *s1++=*cs++;
                                        ~^~~~~

so clearly the char type is treated as unsigned. My exact command line is

clang -c -x c -std=c11 -fno-signed-char -Weverything -D _DLL -D _DEBUG -D _MT -O0 -g3 *.th

And, does the 3 I write at -g3 have any effect or is it spurious?

By the way, does anybody know how can I redirect the diagnosis to a file instead of stdout (or how do I change stdout itself)? I invoke clang from a makefile, in Windows, like

nmake libraries.mak > buildoutput.txt

but this has no effect of the output from the compiler.

Thanks in advance

-- Javier A. M.

I use the -fno-signed-char command line option but it has no effect:
CHAR_MIN is not zero but -128 and I get warnings like

warning: implicit conversion changes signedness: 'const char' to
      'wchar_t' (aka 'unsigned short') [-Wsign-conversion]
                        while(*cs) *s1++=*cs++;
                                        ~^~~~~

so clearly the char type is treated as unsigned. My exact command line is

clang -c -x c -std=c11 -fno-signed-char -Weverything -D _DLL -D _DEBUG -D
_MT -O0 -g3 *.th

I don't know the answer to this question, although the behavior you are
looking for does naively look reasonable.

And, does the 3 I write at -g3 have any effect or is it spurious?

It has no effect, clang treats it the same as -g.

By the way, does anybody know how can I redirect the diagnosis to a file
instead of stdout (or how do I change stdout itself)? I invoke clang from
a makefile, in Windows, like

>nmake libraries.mak > buildoutput.txt

but this has no effect of the output from the compiler.

I expect the diagnostics are written to stderr not stdout and so you could do
   nmake libraries.mak 2> buildoutput.txt
to capture stderr to a file.
--paulr

We had a bug where we silently ignored -fno-signed-char, I’ve fixed this with r238105. As a workaround, you can also use -funsigned-char to achieve the desired effect.

Indeed, -funsigned-char seems the natural option for me, but I wrote -fno-signed-char because that is the one that is explained when you type clang -help. If I remember correctly -funsigned-char does not appear among the options listed there.

You’re right Javier, can you file a bug for this, or even better send a patch :slight_smile:

You're right Javier, can you file a bug for this, or even better send a
patch :slight_smile:

It almost seems natural to introduce -f(no-)signed-wchar and -funsigned-wchar as `char` and `wchar_t` are different types.

Does gcc's version of this flag affect both types?

Jon

I'd like to submit a patch, and another one for the explanatory message of an error, which confused me, and I had to look into the sources to see the actual code triggering the error and understand what was happening (there is no bug in the code, just the error message is not right); but these days I have limited connection to the internet and have to come to a special place and don't have much time here to spend, so those will have to wait till next week at least.