Re: [PATCH] Cast removal



On Thu, 5 Oct 2006 15:14:02 -0700
"Moore, Robert" <robert.moore@xxxxxxxxx> wrote:

If you're discussing this type of thing, I agree wholeheartedly:

static void acpi_processor_notify(acpi_handle handle, u32 event, void
*data) {
- struct acpi_processor *pr = (struct acpi_processor *)data;
+ struct acpi_processor *pr = data;


OK, thanks. I would expect all compilers to be happy with that. However a
bit of googling I did indicated that lint (or some flavour thereof)
complains about the missing cast. Which is dumb of it.

I find this one interesting, as we've put a number of them into the
ACPICA core:

- (void) kmem_cache_destroy(cache);
+ kmem_cache_destroy(cache);

I believe that the point of the (void) is to prevent lint from
squawking, and perhaps some picky ANSI-C compilers. What is the overall
Linux policy on this?

policy = not;

But there's quite a lot of it in the tree.

Actually.. kmem_cache_destroy() returns void, so any checker which complains
about the missing cast needs a stern talking to.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: Determining a functions calling address
    ... > The IDE includes two compilers, Borland's and MINGW 3.2 port of GCC ... a void pointer can point to any type (but is dangerous because it goes ... #ifdef DEBUG ...
    (comp.lang.cpp)
  • Re: why CRT has to written in C
    ... assembly code, but that was just too hard to maintain, and there's little reason to do so ... void * __cdecl memcpy ( ... I clearly said "early" CRTs. ... Early CRT's were written in assembler because early C compilers were ...
    (microsoft.public.vc.mfc)
  • Re: Incrementing a void pointer. Legal C99?
    ... My compilers accept ... gcc with -ansi -pedantic-errors gives only a warning, ... I prefer to call them "diagnostic messages". ... remember that void expressions are evaluated for their side effects. ...
    (comp.lang.c)
  • Re: Variable declaration and initialisation
    ... >> void f{ ... and such compilers will catch ... > strcpy (p, string1); ... allocated memory segments and I'm sure they'll later be ...
    (comp.lang.c)
  • Re: The thorny issue of mains return type (WAS: Top ten errors)
    ... "void main" does not have a clue of programming, ... * Not all compilers are standard conformant. ... * Many compilers (see link in my prev post) document void main as ... * Plenty of books that endorse void main ...
    (alt.comp.lang.learn.c-cpp)