Changeset d16fc78 in mainline for boot/generic/include/printf.h


Ignore:
Timestamp:
2010-11-26T01:07:42Z (13 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
855e0d8
Parents:
1e27d85
Message:
  • verify the correctness of printf()'s and friends' attributes in compile time (use NVERIFY_PRINTF define to suppress the checks)
  • separate non-C99 compliant printf() checks to a standalone 'print5' test and u

se NVERIFY_PRINTF for it

  • improve 'print2' test (use portable constant macros and explicit types)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • boot/generic/include/printf.h

    r1e27d85 rd16fc78  
    3636#include <stdarg.h>
    3737
     38#ifndef NVERIFY_PRINTF
     39
     40#define PRINTF_ATTRIBUTE(start, end) \
     41        __attribute__((format(gnu_printf, start, end)))
     42
     43#else /* NVERIFY_PRINTF */
     44
     45#define PRINTF_ATTRIBUTE(start, end)
     46
     47#endif /* NVERIFY_PRINTF */
     48
    3849#define EOF  (-1)
    3950
    4051extern int puts(const char *);
    41 extern int printf(const char *, ...);
     52extern int printf(const char *, ...)
     53    PRINTF_ATTRIBUTE(1, 2);
    4254extern int vprintf(const char *, va_list);
    4355
Note: See TracChangeset for help on using the changeset viewer.