lkml.org 
[lkml]   [2006]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: my handy-dandy, "coding style" script

    On Dec 21 2006 15:40, Joe Perches wrote:
    >On Fri, 2006-12-22 at 00:29 +0100, Jan Engelhardt wrote:
    >> On Dec 21 2006 14:53, Joe Perches wrote:
    >> >On Thu, 2006-12-21 at 21:52 +0100, Jan Engelhardt wrote:
    >> >> http://lkml.org/lkml/2006/9/30/208
    >> >@@ -1302,7 +1302,7 @@ static int acpi_battery_add(struct acpi_
    >> > battery->init_state = 1;
    >> > }
    >> >- (void)sprintf(dir_name, ACPI_BATTERY_DIR_NAME, id);
    >> >+ sprintf(dir_name, ACPI_BATTERY_DIR_NAME, id);
    >> >These casts can eliminate "return value unused" warnings.
    >>
    >> But only when functions are tagged __must_check, and sprintf is not.
    >
    >or where -Wall is used.

    00:50 takeshi:/dev/shm > cat bla.c
    #include <stdio.h>
    int main(void) {
    char foo[42];
    sprintf(foo, "bar");
    return 0;
    }
    00:52 takeshi:/dev/shm > cc bla.c -Wall
    (no warnings)

    In case you were talking about kernel code, the same (i.e. no warnings)
    happens:

    00:54 takeshi:/dev/shm > make -C /lib/modules/2.6.18.5-jen40b-default/build M=$PWD
    make: Entering directory `/usr/src/linux-2.6.18.5-jen40b-obj/i386/default'
    make -C ../../../linux-2.6.18.5-jen40b O=../linux-2.6.18.5-jen40b-obj/i386/default
    CC [M] /dev/shm/bla2.o
    Building modules, stage 2.
    MODPOST
    LD [M] /dev/shm/bla2.ko
    make: Leaving directory `/usr/src/linux-2.6.18.5-jen40b-obj/i386/default'
    00:54 takeshi:/dev/shm > cat Makefile
    EXTRA_CFLAGS += -Wall
    obj-m += bla2.o




    -`J'
    --
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-12-22 01:21    [W:0.023 / U:60.996 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site