Changeset 5651:b0e163908378 in roaraudio for include


Ignore:
Timestamp:
09/12/12 16:22:42 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

Added compiler checks for printf() like format strings.

Location:
include
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/debug.h

    r5381 r5651  
    7474struct roar_vio_calls * roar_debug_get_stderr(void); 
    7575 
    76 void roar_debug_msg_simple(const char *format, ...); 
     76void roar_debug_msg_simple(const char *format, ...) _LIBROAR_ATTR_PRINTF(1, 2); 
    7777 
    78 void roar_debug_msg(int type, unsigned long int line, const char * file, const char * prefix, const char * format, ...); 
     78void roar_debug_msg(int type, unsigned long int line, const char * file, const char * prefix, const char * format, ...) _LIBROAR_ATTR_PRINTF(5, 6); 
    7979 
    8080#endif 
  • include/libroar/vio_string.h

    r5381 r5651  
    4646char *  roar_vio_fgets   (struct roar_vio_calls * vio, char * s, size_t size) _LIBROAR_ATTR_USE_RESULT _LIBROAR_ATTR_NONNULL_ALL; 
    4747 
    48 int     roar_vio_printf  (struct roar_vio_calls * vio, const char *format, ...) _LIBROAR_ATTR_NONNULL(1, 2); 
     48int     roar_vio_printf  (struct roar_vio_calls * vio, const char *format, ...) _LIBROAR_ATTR_NONNULL(1, 2) _LIBROAR_ATTR_PRINTF(2, 3); 
    4949 
    5050#endif 
  • include/roaraudio/compilerhacks.h

    r5381 r5651  
    3838#define _LIBROAR_ATTR_PURE              __attribute__ ((pure)) 
    3939#define _LIBROAR_ATTR_USE_RESULT        __attribute__ ((warn_unused_result)) 
     40#define _LIBROAR_ATTR_PRINTF(str,args)  __attribute__ ((format (printf, str, args))) 
    4041 
    4142// gcc does not only add a warning on NULL argument for the following 
     
    6768#define _LIBROAR_ATTR_USE_RESULT 
    6869#endif 
     70#ifndef _LIBROAR_ATTR_PRINTF 
     71#define _LIBROAR_ATTR_PRINTF(str,args) 
     72#endif 
    6973 
    7074#ifndef _LIBROAR_IGNORE_RET 
Note: See TracChangeset for help on using the changeset viewer.