#1427 SDCC Warning 154 shows wrong filename

closed-fixed
5
2013-05-25
2008-02-09
Ernst
No

Hi!

I am trying to port software from AVR-GCC to Z80-SDCC 2.7.0.
SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.7.0 #4818 (May 31 2007) (MINGW32)

On a number of source files, I receive the error message: (for example:)

../.././nut/crt/write.c:92: warning 154: converting integral to
pointer without a cast from type 'literal-char'
to type 'struct _NUTFILE generic* '

The "problem" is that "write.c" has only 41 lines. So "write.c:92" points "somewhere".

Interestingly, ALL warning 154 messages show the "92" as line number when the "to" type is 'struct _NUTFILE generic* ' and show the line number 121 when the to type is 'void generic* '.

The source of write.c is attached

SDCC is invoked by:

sdcc -c 2>>d:\pjrc\sdccout.txt -mz80 --stack-auto -DZ80_SBC180 -I../.././nutbld/include -I../.././nut/include ../.././nut/crt/write.c -o write.o

I also tried a newer SDCC version:

D:\pjrc>sdcc --version
SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.7.4 #5000 (Jan 25 2008) (MINGW32)

because I found an email dated 2007-02-12 20:18 in the archive stating a bug (which may be this one, I thought) is fixed by SVN 4631.

Has anybody come across this situation? How may I go forward to find what causes that message?

Regards
Ernst

Maarten Brock [sourceforge.brock@dse.nl] replied:

My guess is that the line is correct but the filename is not. Have a look in the included header files and search for an assignment of a literal value (<128) to such a pointer.

Followup/test (by ernst@stippl.com):

The #include structure of write.c looks like:

#include "nut_io.h"

nut_io.h contains:
#include <sys/types.h>

#include <stdio.h>
#include <stdarg.h>

#include <sys/device.h>

sys/device.h contains:
#include <sys/file.h> <-- the line number referenced this file

I had changed the original file.h contents from

#define NUTFILE_EOF ((NUTFILE *)(-1))

to

#if defined (Z80_SBC180)
NUTFILE * NUTFILE_EOF = -1;
#else
#define NUTFILE_EOF ((NUTFILE *)(-1))
#endif

because in a previous porting attempt (to 8051) I had problems with the original code line.
My change introduced the "warning 154", and the warning message showed the wrong filename (write.c).
After reverting back to the original #define statement, the warning went away.

I will attach the .h files after submitting this report because a have not figured out how to attach multiple files in one go.

Discussion

  • Ernst

    Ernst - 2008-02-09

    The file showing the problem

     
  • Ernst

    Ernst - 2008-02-09

    The changed include file producing the warning

     
  • Ernst

    Ernst - 2008-02-09

    Logged In: YES
    user_id=1107482
    Originator: YES

    File Added: wrong_file.h

     
  • Ernst

    Ernst - 2008-02-09

    The correct include file

     
  • Ernst

    Ernst - 2008-02-09

    Logged In: YES
    user_id=1107482
    Originator: YES

    File Added: file.h

     
  • Ernst

    Ernst - 2008-02-09

    Logged In: YES
    user_id=1107482
    Originator: YES

    File Added: device.h

     
  • Ernst

    Ernst - 2008-02-09

    needed to compile write.c

     
  • Ernst

    Ernst - 2008-02-09

    Logged In: YES
    user_id=1107482
    Originator: YES

    File Added: nut_io.h

     
  • Ernst

    Ernst - 2008-02-09

    needed to compile write.c

     
  • Ernst

    Ernst - 2008-02-09

    needed to compile write.c

     
  • Ernst

    Ernst - 2008-02-09

    Logged In: YES
    user_id=1107482
    Originator: YES

    File Added: types.h

     
  • Borut Ražem

    Borut Ražem - 2008-02-10

    Logged In: YES
    user_id=568035
    Originator: NO

    Ernst,

    I still can't reproduce the problem - I get the error:
    ../.././nutbld/include/nut_io.h:94: syntax error: token -> 'char' ; column 28
    since CONST is not defined.

    Can you please generate the preprocessor output by executing:
    sdcc -E -mz80 --stack-auto -DZ80_SBC180 -I../.././nutbld/include -I../.././nut/include ../.././nut/crt/write.c > write.i
    and attach the file write.i to the bug report?

    P.S.: if you want to attach multiple files put them into archive (zip, tar, tar.gz, ...) and attach the archive.

    Borut

     
  • Ernst

    Ernst - 2008-02-11

    C source with #includes already done

     
  • Ernst

    Ernst - 2008-02-11

    Logged In: YES
    user_id=1107482
    Originator: YES

    Hi Borut!

    I've done as requested and checked that the error occured.

    You will find the line "NUTFILE * NUTFILE_EOF = -1;" in write.i. It is the verison producing the error.
    "#define NUTFILE_EOF ((NUTFILE *)(-1))" will compile correctly.
    The write.c file and its .h files did include "file.h" but not "wrong_file.h", maybe thats the reason you could not
    reproduce the error. Sorry for that and thanks for your efforts.

    regards
    Ernst
    File Added: write.i

     
  • Borut Ražem

    Borut Ražem - 2008-02-13

    Logged In: YES
    user_id=568035
    Originator: NO

    Fixed in svn revision #5003.

    Borut

     
  • Borut Ražem

    Borut Ražem - 2008-02-13
    • labels: --> Icode generator
    • milestone: --> fixed
    • assigned_to: nobody --> borutr
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks