Re: including sparse headers in C++ code

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

 



On Sun, Oct 17, 2010 at 3:31 AM, Tomas Klacko <tomas.klacko@xxxxxxxxx> wrote:
>> What warning do you encounter about CHECK_TYPE?
> I get:
> main.cc: In function ‘int main(int, char**)’:
> main.cc:19: error: comparison between distinct pointer types ‘void*’
> and ‘char*’ lacks a cast
>
> compiler and (important) flags:
> g++ (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu4), -Wall -Werror
>
>
> Now, the code2 (file main.cc):
> I get error:
> main.cc: In function ‘int main(int, char**)’:
> main.cc:18: error: invalid conversion from ‘void*’ to ‘char*’

That sounds like some thing need to be fixed before the patch can go in.

I give this C++ changes more thought. The sparse code is written in
pure C. I don't
want to make C++ as another burden of sparse developers. The
alternative always exist,
which is compiling your sparse related code in C then link to your C++ program.
Here is my guide line for the C++ related changes.

The change needs to make sense in C alone. That means no "#ifdef __cplusplus".
Sparse itself is pure C.I am not a C++ expert, I really  don't know
what is going on
inside the C++ portion of the code. It is pure burden for most sparse
developers who
don't deal with C++, me included.

Personally I don't care about including sparse header in C++. But that
being said,
I am willing to make some compromise. e.g. the keyword renaming adds no value
for the C code, if that is all it takes to make C++ happy, fine.

The rest still need to make sense in C. E.g. removing the dead label_arg union
is a good change by itself.

Fundamentally the C++ and C99 are not compatible.  So there is a limit
you can push
for including C code in C++. Sparse uses a lot of C specific code in
the header file.
For the nasty case, it seems that using the alternative method is not too bad.
It is inconvenient, but only limit to very few users.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux