tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] tiny bit of lint


From: Christian Jullien
Subject: Re: [Tinycc-devel] tiny bit of lint
Date: Tue, 9 May 2017 08:09:56 +0200

I'm really sorry, my intention was not to pollute this mailing list with
randomly selected splint warnings (while true, most splint warnings are
pedandic).

I wish to have time to make a serious investigation with splint warnings,
like:

tcctools.c: (in function tcc_tool_ar)
tcctools.c:72:9: String literal with 17 characters is assigned to char [16]
(no
                    room for null terminator): "/               "
  A string literal is assigned to a char array that is not big enough to
hold
  the null terminator. (Use -stringliteralnoroom to inhibit warning)
tcctools.c:73:9: String literal with 13 characters is assigned to char [12]
(no
                    room for null terminator): "            "
tcctools.c:74:9: String literal with 7 characters is assigned to char [6]
(no
                    room for null terminator): "0     "
tcctools.c:75:9: String literal with 7 characters is assigned to char [6]
(no
                    room for null terminator): "0     "
tcctools.c:76:9: String literal with 9 characters is assigned to char [8]
(no
                    room for null terminator): "0       "
tcctools.c:77:9: String literal with 11 characters is assigned to char [10]
(no
                    room for null terminator): "          "
tcctools.c:78:9: String literal with 3 characters is assigned to char [2]
(no
                    room for null terminator): "`\n"
tcctools.c:82:9: String literal with 17 characters is assigned to char [16]
(no
                    room for null terminator): "                "
tcctools.c:83:9: String literal with 13 characters is assigned to char [12]
(no
                    room for null terminator): "            "
tcctools.c:84:9: String literal with 7 characters is assigned to char [6]
(no
                    room for null terminator): "0     "
tcctools.c:85:9: String literal with 7 characters is assigned to char [6]
(no
                    room for null terminator): "0     "
tcctools.c:86:9: String literal with 9 characters is assigned to char [8]
(no
                    room for null terminator): "0       "
tcctools.c:87:9: String literal with 11 characters is assigned to char [10]
(no
                    room for null terminator): "          "
tcctools.c:88:9: String literal with 3 characters is assigned to char [2]
(no
                    room for null terminator): "`\n" 

-----Original Message-----
From: Tinycc-devel [mailto:address@hidden
On Behalf Of Michael Matz
Sent: lundi 8 mai 2017 20:43
To: address@hidden
Subject: Re: [Tinycc-devel] tiny bit of lint

Hi,

On Mon, 8 May 2017, Christian Jullien wrote:

> tcc.h: (in function is_space)
> tcc.h:1244:12: Operands of == have incompatible types (int, char): ch == '
'
>   A character constant is used as an int. Use +charintliteral to allow
>   character constants to be used as ints.  (This is safe since the 
> actual type
>   of a char constant is int.)

That's not a very useful warning.  As the explanation that splint itself is
giving there's no danger of any misinterpretation of the meaning.

> tcc.h:1244:25: Operands of == have incompatible types (int, char): ch 
> == '\t'
> arm64-gen.c:49:31: Initializer block for reg_classes has 28 elements, but
>     declared as int [25]:

And this is simply wrong.  From arm64-gen:
% grep NB_REGS arm64-gen.c
arm64-gen.c:#define NB_REGS 28 // x0-x18, x30, v0-v7 arm64-gen.c:ST_DATA
const int reg_classes[NB_REGS] = {

So, quite clearly reg_classes is declared as an int[28] just fine.  
splint is probably confused by the NB_REGS definition in x86_64-gen.c (which
defines it to 25), but that's immaterial, those sources aren't used in
arm64-gen.c.


Ciao,
Michael.

_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]