Changeset bf61d3a in mainline for kernel/generic/include


Ignore:
Timestamp:
2010-11-26T01:34:21Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
273b958
Parents:
4b9a410 (diff), 7e752b2 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge compile-time printf() argument checking, fixes of actual printf() arguments and related modifications

Location:
kernel/generic/include
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/config.h

    r4b9a410 rbf61d3a  
    6666
    6767typedef struct {
    68         size_t cpu_count;            /**< Number of processors detected. */
     68        unsigned int cpu_count;      /**< Number of processors detected. */
    6969        volatile size_t cpu_active;  /**< Number of processors that are up and running. */
    7070       
  • kernel/generic/include/cpu.h

    r4b9a410 rbf61d3a  
    8383         * Processor ID assigned by kernel.
    8484         */
    85         size_t id;
     85        unsigned int id;
    8686       
    8787        bool active;
  • kernel/generic/include/interrupt.h

    r4b9a410 rbf61d3a  
    3737
    3838#include <arch/interrupt.h>
     39#include <print.h>
    3940#include <typedefs.h>
    4041#include <proc/task.h>
     
    5758extern exc_table_t exc_table[];
    5859
    59 extern void fault_if_from_uspace(istate_t *, const char *, ...);
     60extern void fault_if_from_uspace(istate_t *, const char *, ...)
     61    PRINTF_ATTRIBUTE(2, 3);
    6062extern iroutine_t exc_register(unsigned int, const char *, bool, iroutine_t);
    6163extern void exc_dispatch(unsigned int, istate_t *);
  • kernel/generic/include/panic.h

    r4b9a410 rbf61d3a  
    3737
    3838#include <typedefs.h>
     39#include <print.h>
    3940
    4041#define panic(fmt, ...) \
     
    6263
    6364extern void panic_common(panic_category_t, struct istate *, int,
    64     uintptr_t, const char *, ...) __attribute__ ((noreturn));
     65    uintptr_t, const char *, ...) __attribute__ ((noreturn))
     66    PRINTF_ATTRIBUTE(5, 6);
    6567
    6668#endif
  • kernel/generic/include/print.h

    r4b9a410 rbf61d3a  
    3939#include <stdarg.h>
    4040
     41#ifndef NVERIFY_PRINTF
     42
     43#define PRINTF_ATTRIBUTE(start, end) \
     44        __attribute__((format(gnu_printf, start, end)))
     45
     46#else /* NVERIFY_PRINTF */
     47
     48#define PRINTF_ATTRIBUTE(start, end)
     49
     50#endif /* NVERIFY_PRINTF */
     51
    4152#define EOF  (-1)
    4253
    4354extern int puts(const char *s);
    44 extern int printf(const char *fmt, ...);
    45 extern int snprintf(char *str, size_t size, const char *fmt, ...);
     55extern int printf(const char *fmt, ...)
     56    PRINTF_ATTRIBUTE(1, 2);
     57extern int snprintf(char *str, size_t size, const char *fmt, ...)
     58    PRINTF_ATTRIBUTE(3, 4);
    4659
    4760extern int vprintf(const char *fmt, va_list ap);
  • kernel/generic/include/stdint.h

    r4b9a410 rbf61d3a  
    3636#define KERN_STDINT_H_
    3737
    38 #define INT8_MIN  (0x80)
    39 #define INT8_MAX  (0x7F)
     38#define INT8_MIN  INT8_C(0x80)
     39#define INT8_MAX  INT8_C(0x7F)
    4040
    41 #define UINT8_MIN  (0u)
    42 #define UINT8_MAX  (0xFFu)
     41#define UINT8_MIN  UINT8_C(0)
     42#define UINT8_MAX  UINT8_C(0xFF)
    4343
    44 #define INT16_MIN  (0x8000)
    45 #define INT16_MAX  (0x7FFF)
     44#define INT16_MIN  INT16_C(0x8000)
     45#define INT16_MAX  INT16_C(0x7FFF)
    4646
    47 #define UINT16_MIN  (0u)
    48 #define UINT16_MAX  (0xFFFFu)
     47#define UINT16_MIN  UINT16_C(0)
     48#define UINT16_MAX  UINT16_C(0xFFFF)
    4949
    50 #define INT32_MIN  (0x80000000l)
    51 #define INT32_MAX  (0x7FFFFFFFl)
     50#define INT32_MIN  INT32_C(0x80000000)
     51#define INT32_MAX  INT32_C(0x7FFFFFFF)
    5252
    53 #define UINT32_MIN  (0ul)
    54 #define UINT32_MAX  (0xFFFFFFFFul)
     53#define UINT32_MIN  UINT32_C(0)
     54#define UINT32_MAX  UINT32_C(0xFFFFFFFF)
    5555
    56 #define INT64_MIN  (0x8000000000000000ll)
    57 #define INT64_MAX  (0x7FFFFFFFFFFFFFFFll)
     56#define INT64_MIN  INT64_C(0x8000000000000000)
     57#define INT64_MAX  INT64_C(0x7FFFFFFFFFFFFFFF)
    5858
    59 #define UINT64_MIN  (0ull)
    60 #define UINT64_MAX  (0xFFFFFFFFFFFFFFFFull)
     59#define UINT64_MIN  UINT64_C(0)
     60#define UINT64_MAX  UINT64_C(0xFFFFFFFFFFFFFFFF)
    6161
    6262#endif
  • kernel/generic/include/synch/spinlock.h

    r4b9a410 rbf61d3a  
    146146        if ((pname)++ > (value)) { \
    147147                (pname) = 0; \
    148                 printf("Deadlock probe %s: exceeded threshold %u\n", \
     148                printf("Deadlock probe %s: exceeded threshold %u\n" \
    149149                    "cpu%u: function=%s, line=%u\n", \
    150150                    #pname, (value), CPU->id, __func__, __LINE__); \
  • kernel/generic/include/sysinfo/abi.h

    r4b9a410 rbf61d3a  
    6666 */
    6767typedef struct {
    68         size_t id;               /**< CPU ID as stored by kernel */
     68        unsigned int id;         /**< CPU ID as stored by kernel */
    6969        bool active;             /**< CPU is activate */
    7070        uint16_t frequency_mhz;  /**< Frequency in MHz */
  • kernel/generic/include/typedefs.h

    r4b9a410 rbf61d3a  
    4040#include <arch/types.h>
    4141
    42 #define NULL    ((void *) 0)
     42#define NULL  ((void *) 0)
    4343
    4444#define false  0
     
    6969typedef int32_t devno_t;
    7070
    71 typedef int32_t wchar_t;
    72 
    7371typedef volatile uint8_t ioport8_t;
    7472typedef volatile uint16_t ioport16_t;
Note: See TracChangeset for help on using the changeset viewer.