• Bug#266644: dpteng/semaphor.c depends on certain c compiler behaviour

    From Anders Henke@1:229/2 to All on Wed Aug 18 17:20:10 2004
    From: [email protected]

    Package: raidutils
    Version: 0.0.4-3
    Severity: minor
    Tags: patch

    When re-compiling the package under woody using gcc 2.95.4 with
    recent debian package building tools, the c-compiler chokes:

    ---cut
    [...]
    gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -D__UNIX__ -DMESSAGES -D_DPT_ACTI
    VE_ALIGNMENT -DI_WANT_SNI_DEBUG -DNEW_LOGGER -Wall -g -O2 -c -o raideng-semaph
    or.o `test -f 'semaphor.c' || echo './'`semaphor.c
    semaphor.c: In function `osdCreateSemaphore':
    semaphor.c:437: warning: unsigned int format, pointer arg (arg 2)
    semaphor.c: In function `osdCreateNamedSemaphore':
    semaphor.c:474: parse error before `unsigned'
    semaphor.c:477: `rtnVal' undeclared (first use in this function) semaphor.c:477: (Each undeclared identifier is reported only once semaphor.c:477: for each function it appears in.)
    semaphor.c:480: warning: control reaches end of non-void function
    semaphor.c: In function `osdRequestSemaphore':
    semaphor.c:716: warning: unsigned int format, uLONG arg (arg 2)
    semaphor.c:629: warning: `oldAlarm' might be used uninitialized in this function
    semaphor.c: In function `osdCreateEventSemaphore':
    semaphor.c:887: warning: unsigned int format, pointer arg (arg 2)
    semaphor.c: In function `osdCreateNamedEventSemaphore':
    semaphor.c:921: parse error before `unsigned'
    semaphor.c:924: `rtnVal' undeclared (first use in this function) semaphor.c:927: warning: control reaches end of non-void function
    semaphor.c: At top level:
    semaphor.c:150: warning: `privateCreateNamedSemaphore' defined but not used make[3]: *** [raideng-semaphor.o] Error 1
    make[3]: Leaving directory `/home/debbuild/src/raidutil/raidutils-0.0.4/raideng'
    make[2]: *** [all-recursive] Error 1
    make[2]: Leaving directory `/home/debbuild/src/raidutil/raidutils-0.0.4' make[1]: *** [all] Error 2
    make[1]: Leaving directory `/home/debbuild/src/raidutil/raidutils-0.0.4'
    make: *** [build-stamp] Error 2
    ---cut

    By moving the definition of rtnVal at two points in dpteng/semaphor.c, compiling (and of course running) the binaries works as intended:

    ---cut
    --- raideng/semaphor.c Thu Apr 29 12:20:10 2004
    +++ /tmp/semaphor.c Wed Aug 18 09:33:23 2004
    @@ -467,11 +467,12 @@
    SEMAPHORE_T osdCreateNamedSemaphore(char *name)
    {
    char temp[MAX_SEM_NAME_LEN];
    + SEMAPHORE_T rtnVal;

    strcpy(temp, "/tmp/");
    strcat(temp, name);

    - SEMAPHORE_T rtnVal = privateCreateNamedSemaphore(temp, 0);
    + rtnVal = privateCreateNamedSemaphore(temp, 0);

    if (Verbose)
    printf("\nosdCreateNamedSemaphore : Rtn = %x", rtnVal);
    @@ -914,11 +915,12 @@
    SEMAPHORE_T osdCreateNamedEventSemaphore(char *name)
    {
    char temp[MAX_SEM_NAME_LEN];
    + SEMAPHORE_T rtnVal;

    strcpy(temp, "/tmp/");
    strcat(temp, name);

    - SEMAPHORE_T rtnVal = privateCreateNamedSemaphore(temp, 1);
    + rtnVal = privateCreateNamedSemaphore(temp, 1);

    if (Verbose)
    printf("\nosdCreateNamedEventSemaphore : Rtn = %x", rtnVal);
    ---cut


    Anders
    --
    Schlund + Partner AG Systemadministration


    --
    To UNSUBSCRIBE, email t