Bug in stdio.h

2014-01-09
2014-01-15
  • Brennen Ball
    Brennen Ball
    2014-01-09

    It looks like whenever you guys changed "SDCC_mcs51" to "__SDCC_mcs51", stdio.h didn't get updated. I'm specifically referencing line 84 in SDCC/include/stdio.h for SDCC version 3.3.0.

    This issue causes the compiler to throw a warning due to an implicit declaration when using printf_fast(), printf_fast_f(), or printf_tiny(), since these prototypes don't get defined in stdio.h due to using the incorrect #define. This subsequently causes a compiler error for using too many parameters for the printf_*() function.

    This is (obviously) seen when compiling for the mcs51. The failure can be achieved either by not specifying a processor target or by using -mmcs51 at the command line. I would imagine a simple "hello world" using printf_tiny() would show the problem for testing purposes.

     
  • Maarten Brock
    Maarten Brock
    2014-01-14

    Thanks for pointing this out, though a bug report would have been better. I guess it went unnoticed due to the fact that these functions are incompatible with the regression test suite and thereby not even linked in without execution.

     
  • Maarten Brock
    Maarten Brock
    2014-01-15

    It may also have been on purpose as it declares functions that are not defined in the standard. When you use --std-sdccXX the sdcc extensions are enabled and this macro is defined.