Changeset bbe7848 in mainline for uspace/lib/c/include


Ignore:
Timestamp:
2010-11-26T14:19:00Z (15 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b12d3cc
Parents:
03171de (diff), ffdd2b9 (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 mainline changes

Local changes: removed extra parameters to printf (variables
that would be ignored anyway).

Location:
uspace/lib/c/include
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/assert.h

    r03171de rbbe7848  
    5151
    5252#ifndef NDEBUG
    53 #       define assert(expr) \
    54                 do { \
    55                         if (!(expr)) { \
    56                                 printf("Assertion failed (%s) at file '%s', " \
    57                                     "line %d.\n", #expr, __FILE__, __LINE__); \
    58                                 abort(); \
    59                         } \
    60                 } while (0)
    61 #else
    62 #       define assert(expr)
    63 #endif
     53
     54#define assert(expr) \
     55        do { \
     56                if (!(expr)) { \
     57                        printf("Assertion failed (%s) at file '%s', " \
     58                            "line %d.\n", #expr, __FILE__, __LINE__); \
     59                        abort(); \
     60                } \
     61        } while (0)
     62
     63#else /* NDEBUG */
     64
     65#define assert(expr)
     66
     67#endif /* NDEBUG */
    6468
    6569#endif
  • uspace/lib/c/include/device/char.h

    r03171de rbbe7848  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28  
     28
    2929 /** @addtogroup libc
    3030 * @{
     
    3232/** @file
    3333 */
    34  
     34
    3535#ifndef LIBC_DEVICE_HW_RES_H_
    3636#define LIBC_DEVICE_HW_RES_H_
     
    3838typedef enum {
    3939        CHAR_READ_DEV = 0,
    40         CHAR_WRITE_DEV 
     40        CHAR_WRITE_DEV
    4141} hw_res_funcs_t;
    4242
    43 int read_dev(int dev_phone, void *buf, size_t len);
    44 int write_dev(int dev_phone, void *buf, size_t len);
     43ssize_t read_dev(int dev_phone, void *buf, size_t len);
     44ssize_t write_dev(int dev_phone, void *buf, size_t len);
    4545
    4646#endif
  • uspace/lib/c/include/err.h

    r03171de rbbe7848  
    3838#include <stdio.h>
    3939
    40 #define errx(status, fmt, ...) { \
    41         printf((fmt), ##__VA_ARGS__); \
    42         _exit(status); \
    43 }
     40#define errx(status, fmt, ...) \
     41        { \
     42                printf((fmt), ##__VA_ARGS__); \
     43                _exit(status); \
     44        }
    4445
    4546#endif
     
    4748/** @}
    4849 */
    49 
  • uspace/lib/c/include/malloc.h

    r03171de rbbe7848  
    4141extern uintptr_t get_max_heap_addr(void);
    4242
    43 extern void *malloc(const size_t size);
    44 extern void *calloc(const size_t nmemb, const size_t size);
    45 extern void *memalign(const size_t align, const size_t size);
     43extern void *malloc(const size_t size)
     44    __attribute__((malloc));
     45extern void *calloc(const size_t nmemb, const size_t size)
     46    __attribute__((malloc));
     47extern void *memalign(const size_t align, const size_t size)
     48    __attribute__((malloc));
    4649extern void *realloc(const void *addr, const size_t size);
    4750extern void free(const void *addr);
  • uspace/lib/c/include/stdint.h

    r03171de rbbe7848  
    3636#define LIBC_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#include <libarch/types.h>
  • uspace/lib/c/include/stdio.h

    r03171de rbbe7848  
    4141#include <adt/list.h>
    4242
     43#ifndef NVERIFY_PRINTF
     44
     45#define PRINTF_ATTRIBUTE(start, end) \
     46        __attribute__((format(gnu_printf, start, end)))
     47
     48#else /* NVERIFY_PRINTF */
     49
     50#define PRINTF_ATTRIBUTE(start, end)
     51
     52#endif /* NVERIFY_PRINTF */
     53
    4354#define EOF  (-1)
    4455
     
    149160
    150161/* Formatted string output functions */
    151 extern int fprintf(FILE *, const char*, ...);
     162extern int fprintf(FILE *, const char*, ...)
     163    PRINTF_ATTRIBUTE(2, 3);
    152164extern int vfprintf(FILE *, const char *, va_list);
    153165
    154 extern int printf(const char *, ...);
     166extern int printf(const char *, ...)
     167    PRINTF_ATTRIBUTE(1, 2);
    155168extern int vprintf(const char *, va_list);
    156169
    157 extern int snprintf(char *, size_t , const char *, ...);
    158 extern int asprintf(char **, const char *, ...);
     170extern int snprintf(char *, size_t , const char *, ...)
     171    PRINTF_ATTRIBUTE(3, 4);
     172extern int asprintf(char **, const char *, ...)
     173    PRINTF_ATTRIBUTE(2, 3);
    159174extern int vsnprintf(char *, size_t, const char *, va_list);
    160175
  • uspace/lib/c/include/str.h

    r03171de rbbe7848  
    8686extern char *str_ndup(const char *, size_t max_size);
    8787
     88extern int str_uint64(const char *, char **, unsigned int, bool, uint64_t *);
     89extern int str_size_t(const char *, char **, unsigned int, bool, size_t *);
     90
    8891extern void order_suffix(const uint64_t val, uint64_t *rv, char *suffix);
    8992
  • uspace/lib/c/include/sys/typefmt.h

    r03171de rbbe7848  
    3939#include <inttypes.h>
    4040
    41 /* off64_t */
     41/* off64_t, aoff64_t */
    4242#define PRIdOFF64 PRId64
    4343#define PRIuOFF64 PRIu64
     
    4545#define PRIXOFF64 PRIX64
    4646
    47 /* (s)size_t */
    48 #define PRIdSIZE PRIdPTR
    49 #define PRIuSIZE PRIuPTR
    50 #define PRIxSIZE PRIxPTR
    51 #define PRIXSIZE PRIXPTR
    52 
    53 /* sysarg_t */
    54 #define PRIdSYSARG PRIdPTR
    55 #define PRIuSYSARG PRIuPTR
    56 #define PRIxSYSARG PRIxPTR
    57 #define PRIXSYSARG PRIxPTR
    58 
    59 /* ipcarg_t */
    60 #define PRIdIPCARG PRIdPTR
    61 #define PRIuIPCARG PRIuPTR
    62 #define PRIxIPCARG PRIxPTR
    63 #define PRIXIPCARG PRIXPTR
    64 
    65 /* taskid_t */
    66 #define PRIdTASKID PRId64
    67 #define PRIuTASKID PRIu64
    68 #define PRIxTASKID PRIx64
    69 #define PRIXTASKID PRIx64
    70 
    7147#endif
    7248
  • uspace/lib/c/include/sys/types.h

    r03171de rbbe7848  
    4646typedef uint64_t aoff64_t;
    4747
    48 /** Unicode code point */
    49 typedef int32_t wchar_t;
    50 
    5148typedef volatile uint8_t ioport8_t;
    5249typedef volatile uint16_t ioport16_t;
Note: See TracChangeset for help on using the changeset viewer.