Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 810a36f in mainline


Ignore:
Timestamp:
2017-10-24T05:29:08Z (3 years ago)
Author:
jzr <zarevucky.jiri@…>
Branches:
master
Children:
b1eb7ef
Parents:
c8fbbe7 (diff), 673ea28 (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 branch 'types'.

Files:
8 added
32 deleted
69 edited
8 moved

Legend:

Unmodified
Added
Removed
  • abi/include/_bits/NULL.h

    rc8fbbe7 r810a36f  
    11/*
    2  * Copyright (c) 2006 Ondrej Palkovsky
     2 * Copyright (c) 2017 CZ.NIC, z.s.p.o.
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libcamd64
     29/* Authors:
     30 *      Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
     31 */
     32
     33/** @addtogroup bits
    3034 * @{
    3135 */
    3236/** @file
     37 * Definition of constant NULL.
     38 *
     39 * This definition is designed to work in both C and C++, and use
     40 * the special constant `nullptr` in C++11 and above.
     41 * Including this file is preferrable to defining the constant separately.
    3342 */
    3443
    35 #ifndef LIBC_amd64_STDINT_H_
    36 #define LIBC_amd64_STDINT_H_
     44#ifndef _BITS_NULL_H_
     45#define _BITS_NULL_H_
    3746
    38 #include <libarch/common.h>
     47#ifndef NULL
    3948
    40 #define SIZE_MIN  UINT64_MIN
    41 #define SIZE_MAX  UINT64_MAX
     49#if __cplusplus >= 201103L
     50#define NULL  nullptr
     51#elif defined(__cplusplus)
     52#define NULL  0L
     53#else
     54#define NULL  ((void *) 0)
     55#endif
    4256
    43 #define UINTPTR_MAX UINT64_MAX
    44 typedef uint64_t uintptr_t;
    45 
    46 #define INTPTR_MIN INT64_MIN
    47 #define INTPTR_MAX INT64_MAX
    48 typedef int64_t intptr_t;
    49 
    50 #define UINTMAX_MAX UINT64_MAX
    51 typedef uint64_t uintmax_t;
    52 
    53 #define INTMAX_MAX INT64_MAX
    54 typedef int64_t intmax_t;
     57#endif
    5558
    5659#endif
  • abi/include/_bits/WEOF.h

    rc8fbbe7 r810a36f  
    11/*
    2  * Copyright (c) 2006 Ondrej Palkovsky
     2 * Copyright (c) 2017 CZ.NIC, z.s.p.o.
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libcamd64
     29/* Authors:
     30 *      Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
     31 */
     32
     33/** @addtogroup bits
    3034 * @{
    3135 */
     
    3337 */
    3438
    35 #ifndef LIBC_amd64_STDDEF_H_
    36 #define LIBC_amd64_STDDEF_H_
     39#ifndef _BITS_WEOF_H_
     40#define _BITS_WEOF_H_
    3741
    38 #include <libarch/common.h>
     42#include <_bits/macros.h>
    3943
    40 typedef uint64_t size_t;
    41 typedef int64_t ssize_t;
    42 typedef int64_t ptrdiff_t;
     44#define WEOF  __WINT_EOF__
    4345
    4446#endif
  • abi/include/_bits/all.h

    rc8fbbe7 r810a36f  
    11/*
    2  * Copyright (c) 2006 Ondrej Palkovsky
     2 * Copyright (c) 2017 CZ.NIC, z.s.p.o.
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libcamd64
     29/* Authors:
     30 *      Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
     31 */
     32
     33/** @addtogroup bits
    3034 * @{
    3135 */
     
    3337 */
    3438
    35 #ifndef LIBC_amd64_TYPES_H_
    36 #define LIBC_amd64_TYPES_H_
     39#ifndef _BITS_ALL_H_
     40#define _BITS_ALL_H_
    3741
    38 #include <libarch/common.h>
    39 #include <libarch/stddef.h>
    40 #include <libarch/stdint.h>
    41 
    42 #define __64_BITS__
    43 
    44 #define SSIZE_MIN  INT64_MIN
    45 #define SSIZE_MAX  INT64_MAX
    46 
    47 typedef uint64_t sysarg_t;
    48 typedef int64_t native_t;
    49 
    50 typedef uint64_t atomic_count_t;
    51 typedef int64_t atomic_signed_t;
     42#include <_bits/inttypes.h>
     43#include <_bits/limits.h>
     44#include <_bits/native.h>
     45#include <_bits/ptrdiff_t.h>
     46#include <_bits/size_t.h>
     47#include <_bits/ssize_t.h>
     48#include <_bits/stdint.h>
     49#include <_bits/wchar_t.h>
     50#include <_bits/wint_t.h>
    5251
    5352#endif
  • abi/include/_bits/limits.h

    rc8fbbe7 r810a36f  
    11/*
    2  * Copyright (c) 2006 Ondrej Palkovsky
     2 * Copyright (c) 2017 CZ.NIC, z.s.p.o.
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libcarm32
     29/* Authors:
     30 *      Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
     31 */
     32
     33/** @addtogroup bits
    3034 * @{
    3135 */
     
    3337 */
    3438
    35 #ifndef LIBC_arm32_STDINT_H_
    36 #define LIBC_arm32_STDINT_H_
     39#ifndef _BITS_LIMITS_H_
     40#define _BITS_LIMITS_H_
    3741
    38 #include <libarch/common.h>
     42#include <_bits/macros.h>
    3943
    40 #define SIZE_MIN  UINT32_MIN
    41 #define SIZE_MAX  UINT32_MAX
     44/* _MIN macros for unsigned types are non-standard (and of course, always 0),
     45 * but we already have them for some reason, so whatever.
     46 */
    4247
    43 #define UINTPTR_MAX UINT32_MAX
    44 typedef uint32_t uintptr_t;
     48#define CHAR_BIT  __CHAR_BIT__
    4549
    46 #define INTPTR_MIN INT32_MIN
    47 #define INTPTR_MAX INT32_MAX
    48 typedef int32_t intptr_t;
     50#define SCHAR_MIN  __SCHAR_MIN__
     51#define SCHAR_MAX  __SCHAR_MAX__
    4952
    50 #define UINTMAX_MAX UINT64_MAX
    51 typedef uint64_t uintmax_t;
     53#define UCHAR_MIN  0
     54#define UCHAR_MAX  __UCHAR_MAX__
    5255
    53 #define INTMAX_MAX INT64_MAX
    54 typedef int64_t intmax_t;
     56#define CHAR_MIN  __CHAR_MIN__
     57#define CHAR_MAX  __CHAR_MAX__
     58
     59#define MB_LEN_MAX  16
     60
     61#define SHRT_MIN  __SHRT_MIN__
     62#define SHRT_MAX  __SHRT_MAX__
     63
     64#define USHRT_MIN  0
     65#define USHRT_MAX  __USHRT_MAX__
     66
     67#define INT_MIN  __INT_MIN__
     68#define INT_MAX  __INT_MAX__
     69
     70#define UINT_MIN  0U
     71#define UINT_MAX  __UINT_MAX__
     72
     73#define LONG_MIN  __LONG_MIN__
     74#define LONG_MAX  __LONG_MAX__
     75
     76#define ULONG_MIN  0UL
     77#define ULONG_MAX  __ULONG_MAX__
     78
     79#define LLONG_MIN  __LLONG_MIN__
     80#define LLONG_MAX  __LLONG_MAX__
     81
     82#define ULLONG_MIN  0ULL
     83#define ULLONG_MAX  __ULLONG_MAX__
    5584
    5685#endif
  • abi/include/_bits/native.h

    rc8fbbe7 r810a36f  
    11/*
    2  * Copyright (c) 2006 Ondrej Palkovsky
     2 * Copyright (c) 2017 CZ.NIC, z.s.p.o.
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libcabs32
     29/* Authors:
     30 *      Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
     31 */
     32
     33/** @addtogroup bits
    3034 * @{
    3135 */
    3236/** @file
     37 * A bunch of type aliases HelenOS code uses.
     38 *
     39 * They were originally defined as either u/int32_t or u/int64_t,
     40 * specifically for each architecture, but in practice they are
     41 * currently assumed to be identical to u/intptr_t, so we do just that.
    3342 */
    3443
    35 #ifndef LIBC_abs32_STDINT_H_
    36 #define LIBC_abs32_STDINT_H_
     44#ifndef _BITS_NATIVE_H_
     45#define _BITS_NATIVE_H_
    3746
    38 #include <libarch/common.h>
     47#include <_bits/macros.h>
    3948
    40 #define SIZE_MAX UINT32_MAX
     49#define ATOMIC_COUNT_MIN  __UINTPTR_MIN__
     50#define ATOMIC_COUNT_MAX  __UINTPTR_MAX__
    4151
    42 #define UINTPTR_MAX UINT32_MAX
    43 typedef uint32_t uintptr_t;
     52typedef __UINTPTR_TYPE__ pfn_t;
     53typedef __UINTPTR_TYPE__ ipl_t;
     54typedef __UINTPTR_TYPE__ sysarg_t;
     55typedef __INTPTR_TYPE__  native_t;
     56typedef __UINTPTR_TYPE__ atomic_count_t;
     57typedef __INTPTR_TYPE__  atomic_signed_t;
    4458
    45 #define INTPTR_MIN INT32_MIN
    46 #define INTPTR_MAX INT32_MAX
    47 typedef int32_t intptr_t;
    48 
    49 #define UINTMAX_MAX UINT64_MAX
    50 typedef uint64_t uintmax_t;
    51 
    52 #define INTMAX_MAX INT64_MAX
    53 typedef int64_t intmax_t;
     59#define PRIdn  __PRIdPTR__  /**< Format for native_t. */
     60#define PRIun  __PRIuPTR__  /**< Format for sysarg_t. */
     61#define PRIxn  __PRIxPTR__  /**< Format for hexadecimal sysarg_t. */
     62#define PRIua  __PRIuPTR__  /**< Format for atomic_count_t. */
    5463
    5564#endif
  • abi/include/_bits/size_t.h

    rc8fbbe7 r810a36f  
    11/*
    2  * Copyright (c) 2006 Ondrej Palkovsky
     2 * Copyright (c) 2017 CZ.NIC, z.s.p.o.
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libcabs32
     29/* Authors:
     30 *      Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
     31 */
     32
     33/** @addtogroup bits
    3034 * @{
    3135 */
     
    3337 */
    3438
    35 #ifndef LIBC_abs32_STDDEF_H_
    36 #define LIBC_abs32_STDDEF_H_
     39#ifndef _BITS_SIZE_T_H_
     40#define _BITS_SIZE_T_H_
    3741
    38 #include <libarch/common.h>
     42#include <_bits/macros.h>
    3943
    40 typedef uint32_t size_t;
    41 typedef int32_t ssize_t;
    42 typedef int32_t ptrdiff_t;
     44typedef __SIZE_TYPE__ size_t;
    4345
    4446#endif
  • abi/include/_bits/wchar_t.h

    rc8fbbe7 r810a36f  
    11/*
    2  * Copyright (c) 2006 Ondrej Palkovsky
     2 * Copyright (c) 2017 CZ.NIC, z.s.p.o.
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libcarm32
     29/* Authors:
     30 *      Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
     31 */
     32
     33/** @addtogroup bits
    3034 * @{
    3135 */
     
    3337 */
    3438
    35 #ifndef LIBC_arm32_STDDEF_H_
    36 #define LIBC_arm32_STDDEF_H_
     39#ifndef _BITS_WCHAR_T_H_
     40#define _BITS_WCHAR_T_H_
    3741
    38 #include <libarch/common.h>
     42#include <_bits/macros.h>
    3943
    40 typedef uint32_t size_t;
    41 typedef int32_t ssize_t;
    42 typedef int32_t ptrdiff_t;
     44typedef __WCHAR_TYPE__ wchar_t;
    4345
    4446#endif
  • abi/include/_bits/wint_t.h

    rc8fbbe7 r810a36f  
    11/*
    2  * Copyright (c) 2006 Ondrej Palkovsky
     2 * Copyright (c) 2017 CZ.NIC, z.s.p.o.
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libcia32
     29/* Authors:
     30 *      Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
     31 */
     32
     33/** @addtogroup bits
    3034 * @{
    3135 */
     
    3337 */
    3438
    35 #ifndef LIBC_ia32_STDDEF_H_
    36 #define LIBC_ia32_STDDEF_H_
     39#ifndef _BITS_WINT_T_H_
     40#define _BITS_WINT_T_H_
    3741
    38 #include <libarch/common.h>
     42#include <_bits/macros.h>
    3943
    40 typedef uint32_t size_t;
    41 typedef int32_t ssize_t;
    42 typedef int32_t ptrdiff_t;
     44typedef __WINT_TYPE__ wint_t;
    4345
    4446#endif
  • boot/Makefile.build

    rc8fbbe7 r810a36f  
    109109endif
    110110
    111 depend: $(ARCH_INCLUDE) $(GENARCH_INCLUDE) $(COMMON_HEADER_ARCH) $(PRE_DEPEND)
     111depend: $(ARCH_INCLUDE) $(GENARCH_INCLUDE) $(PRE_DEPEND)
    112112
    113113$(COMPS).s: $(COMPS).zip
     
    133133$(GENARCH_INCLUDE) $(GENARCH_INCLUDE)/%.h: genarch/include/
    134134        ln -sfn ../../$< $@
    135 
    136 $(COMMON_HEADER_ARCH): $(COMMON_HEADER)
    137         ln -sfn ../../../$< $@
  • boot/Makefile.common

    rc8fbbe7 r810a36f  
    3636COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
    3737COMMON_HEADER = $(ROOT_PATH)/common.h
    38 COMMON_HEADER_ARCH = arch/$(BARCH)/include/common.h
    3938
    4039CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
  • boot/arch/arm32/include/types.h

    rc8fbbe7 r810a36f  
    3737#define BOOT_arm32_TYPES_H
    3838
    39 #include <arch/common.h>
     39#include <_bits/all.h>
    4040
    4141#define TASKMAP_MAX_RECORDS        32
    4242#define BOOTINFO_TASK_NAME_BUFLEN  32
    43 
    44 typedef uint32_t size_t;
    45 typedef uint32_t uintptr_t;
    46 
    47 typedef uint32_t pfn_t;
    48 
    49 typedef int32_t ptrdiff_t;
    5043
    5144typedef struct {
  • boot/arch/ia64/include/types.h

    rc8fbbe7 r810a36f  
    3030#define BOOT_ia64_TYPES_H_
    3131
    32 #include <arch/common.h>
     32#include <_bits/all.h>
    3333
    3434#define TASKMAP_MAX_RECORDS             32
    3535#define BOOTINFO_TASK_NAME_BUFLEN       32
    3636#define MEMMAP_ITEMS                    128
    37 
    38 typedef uint64_t size_t;
    39 typedef uint64_t sysarg_t;
    40 typedef uint64_t uintptr_t;
    41 
    42 typedef int64_t ptrdiff_t;
    4337
    4438typedef struct {
  • boot/arch/mips32/include/types.h

    rc8fbbe7 r810a36f  
    3030#define BOOT_mips32_TYPES_H_
    3131
    32 #include <arch/common.h>
     32#include <_bits/all.h>
    3333
    3434#define TASKMAP_MAX_RECORDS        32
    3535#define CPUMAP_MAX_RECORDS         32
    3636#define BOOTINFO_TASK_NAME_BUFLEN  32
    37 
    38 typedef uint32_t size_t;
    39 typedef uint32_t uintptr_t;
    40 
    41 typedef int32_t ptrdiff_t;
    4237
    4338typedef struct {
  • boot/arch/ppc32/include/types.h

    rc8fbbe7 r810a36f  
    3030#define BOOT_ppc32_TYPES_H_
    3131
    32 #include <arch/common.h>
     32#include <_bits/all.h>
    3333
    3434#define TASKMAP_MAX_RECORDS        32
    3535#define BOOTINFO_TASK_NAME_BUFLEN  32
    36 
    37 typedef uint32_t size_t;
    38 typedef uint32_t uintptr_t;
    39 typedef uint32_t sysarg_t;
    40 typedef int32_t native_t;
    41 
    42 typedef int32_t ptrdiff_t;
    4336
    4437typedef struct {
  • boot/arch/riscv64/include/types.h

    rc8fbbe7 r810a36f  
    3030#define BOOT_riscv64_TYPES_H_
    3131
    32 #include <arch/common.h>
     32#include <_bits/all.h>
    3333
    3434#define MEMMAP_MAX_RECORDS         32
    3535#define TASKMAP_MAX_RECORDS        32
    3636#define BOOTINFO_TASK_NAME_BUFLEN  32
    37 
    38 typedef uint64_t size_t;
    39 typedef uint64_t uintptr_t;
    40 
    41 typedef int64_t ptrdiff_t;
    4237
    4338typedef struct {
  • boot/arch/sparc64/include/types.h

    rc8fbbe7 r810a36f  
    3030#define BOOT_sparc64_TYPES_H_
    3131
    32 #include <arch/common.h>
     32#include <_bits/all.h>
    3333
    3434#define TASKMAP_MAX_RECORDS        32
    3535#define BOOTINFO_TASK_NAME_BUFLEN  32
    36 
    37 typedef uint64_t size_t;
    38 typedef uint64_t uintptr_t;
    39 typedef uint64_t sysarg_t;
    40 typedef int64_t native_t;
    41 
    42 typedef int64_t ptrdiff_t;
    4336
    4437typedef struct {
  • boot/generic/include/stddef.h

    rc8fbbe7 r810a36f  
    3333#define BOOT_STDDEF_H_
    3434
    35 #include <arch/common.h>
    3635#include <arch/types.h>
    3736
    38 #define NULL  ((void *) 0)
     37#include <_bits/NULL.h>
    3938
    4039#endif
  • boot/generic/include/stdint.h

    rc8fbbe7 r810a36f  
    3333#define BOOT_STDINT_H_
    3434
    35 #include <arch/common.h>
    3635#include <arch/types.h>
    37 
    38 #define INT8_MIN  INT8_C(0x80)
    39 #define INT8_MAX  INT8_C(0x7F)
    40 
    41 #define UINT8_MIN  UINT8_C(0)
    42 #define UINT8_MAX  UINT8_C(0xFF)
    43 
    44 #define INT16_MIN  INT16_C(0x8000)
    45 #define INT16_MAX  INT16_C(0x7FFF)
    46 
    47 #define UINT16_MIN  UINT16_C(0)
    48 #define UINT16_MAX  UINT16_C(0xFFFF)
    49 
    50 #define INT32_MIN  INT32_C(0x80000000)
    51 #define INT32_MAX  INT32_C(0x7FFFFFFF)
    52 
    53 #define UINT32_MIN  UINT32_C(0)
    54 #define UINT32_MAX  UINT32_C(0xFFFFFFFF)
    55 
    56 #define INT64_MIN  INT64_C(0x8000000000000000)
    57 #define INT64_MAX  INT64_C(0x7FFFFFFFFFFFFFFF)
    58 
    59 #define UINT64_MIN  UINT64_C(0)
    60 #define UINT64_MAX  UINT64_C(0xFFFFFFFFFFFFFFFF)
    6136
    6237#endif
  • boot/generic/src/printf_core.c

    rc8fbbe7 r810a36f  
    101101        PrintfQualifierLongLong,
    102102        PrintfQualifierPointer,
    103         PrintfQualifierSize
     103        PrintfQualifierSize,
     104        PrintfQualifierMax
    104105} qualifier_t;
    105106
     
    643644                                uc = str_decode(fmt, &nxt, STR_NO_LIMIT);
    644645                                break;
     646                        case 'j':
     647                                qualifier = PrintfQualifierMax;
     648                                i = nxt;
     649                                uc = str_decode(fmt, &nxt, STR_NO_LIMIT);
     650                                break;
    645651                        default:
    646652                                /* Default type */
     
    759765                                number = (uint64_t) va_arg(ap, size_t);
    760766                                break;
     767                        case PrintfQualifierMax:
     768                                size = sizeof(uintmax_t);
     769                                number = (uint64_t) va_arg(ap, uintmax_t);
     770                                break;
    761771                        default:
    762772                                /* Unknown qualifier */
  • boot/generic/src/str.c

    rc8fbbe7 r810a36f  
    104104
    105105/** Check the condition if wchar_t is signed */
    106 #ifdef WCHAR_IS_UNSIGNED
     106#ifdef __WCHAR_UNSIGNED__
    107107        #define WCHAR_SIGNED_CHECK(cond)  (true)
    108108#else
  • kernel/Makefile

    rc8fbbe7 r810a36f  
    458458        done
    459459
    460 depend: $(COMMON_HEADER_ARCH) $(AUTOGENS_H)
    461 
    462 $(COMMON_HEADER_ARCH): $(COMMON_HEADER)
    463         ln -sfn ../../../../$< $@
     460depend: $(AUTOGENS_H)
    464461
    465462autogen_clean:
  • kernel/arch/abs32le/include/arch/types.h

    rc8fbbe7 r810a36f  
    3636#define KERN_abs32le_TYPES_H_
    3737
    38 #include <arch/common.h>
    39 
    40 #define ATOMIC_COUNT_MIN  UINT32_MIN
    41 #define ATOMIC_COUNT_MAX  UINT32_MAX
    42 
    43 typedef uint32_t size_t;
    44 typedef int32_t ssize_t;
    45 
    46 typedef uint32_t uintptr_t;
    47 typedef uint32_t pfn_t;
    48 
    49 typedef uint32_t ipl_t;
    50 
    51 typedef uint32_t sysarg_t;
    52 typedef int32_t native_t;
    53 typedef uint32_t atomic_count_t;
     38#include <_bits/all.h>
    5439
    5540typedef struct {
    5641} fncptr_t;
    57 
    58 #define PRIdn  PRId32  /**< Format for native_t. */
    59 #define PRIun  PRIu32  /**< Format for sysarg_t. */
    60 #define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
    61 #define PRIua  PRIu32  /**< Format for atomic_count_t. */
    6242
    6343#endif
  • kernel/arch/amd64/include/arch/types.h

    rc8fbbe7 r810a36f  
    3636#define KERN_amd64_TYPES_H_
    3737
    38 #include <arch/common.h>
    39 
    40 typedef uint64_t size_t;
    41 typedef int64_t ssize_t;
    42 
    43 typedef uint64_t uintptr_t;
    44 typedef uint64_t pfn_t;
    45 
    46 typedef uint64_t ipl_t;
    47 
    48 typedef uint64_t sysarg_t;
    49 typedef int64_t native_t;
    50 typedef uint64_t atomic_count_t;
     38#include <_bits/all.h>
    5139
    5240typedef struct {
    5341} fncptr_t;
    54 
    55 #define PRIdn  PRId64  /**< Format for native_t. */
    56 #define PRIun  PRIu64  /**< Format for sysarg_t. */
    57 #define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
    58 #define PRIua  PRIu64  /**< Format for atomic_count_t. */
    5942
    6043#endif
  • kernel/arch/arm32/include/arch/types.h

    rc8fbbe7 r810a36f  
    3737#define KERN_arm32_TYPES_H_
    3838
    39 #include <arch/common.h>
    40 
    4139#ifndef DOXYGEN
    4240        #define ATTRIBUTE_PACKED __attribute__((packed))
     
    4543#endif
    4644
    47 typedef uint32_t size_t;
    48 typedef int32_t ssize_t;
    49 
    50 typedef uint32_t uintptr_t;
    51 typedef uint32_t pfn_t;
    52 
    53 typedef uint32_t ipl_t;
    54 
    55 typedef uint32_t sysarg_t;
    56 typedef int32_t native_t;
    57 typedef uint32_t atomic_count_t;
     45#include <_bits/all.h>
    5846
    5947typedef struct {
    6048} fncptr_t;
    61 
    62 #define PRIdn  PRId32  /**< Format for native_t. */
    63 #define PRIun  PRIu32  /**< Format for sysarg_t. */
    64 #define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
    65 #define PRIua  PRIu32  /**< Format for atomic_count_t. */
    6649
    6750#endif
  • kernel/arch/ia32/include/arch/types.h

    rc8fbbe7 r810a36f  
    3636#define KERN_ia32_TYPES_H_
    3737
    38 #include <arch/common.h>
    39 
    40 typedef uint32_t size_t;
    41 typedef int32_t ssize_t;
    42 
    43 typedef uint32_t uintptr_t;
    44 typedef uint32_t pfn_t;
    45 
    46 typedef uint32_t ipl_t;
    47 
    48 typedef uint32_t sysarg_t;
    49 typedef int32_t native_t;
    50 typedef uint32_t atomic_count_t;
     38#include <_bits/all.h>
    5139
    5240typedef struct {
    5341} fncptr_t;
    54 
    55 #define PRIdn  PRId32  /**< Format for native_t. */
    56 #define PRIun  PRIu32  /**< Format for sysarg_t. */
    57 #define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
    58 #define PRIua  PRIu32  /**< Format for atomic_count_t. */
    5942
    6043#endif
  • kernel/arch/ia32/src/interrupt.c

    rc8fbbe7 r810a36f  
    8888            istate->esi, istate->edi, istate->ebp,
    8989            istate_from_uspace(istate) ? istate->esp :
    90             (uintptr_t) &istate->esp);
     90            (uint32_t) &istate->esp);
    9191}
    9292
  • kernel/arch/ia64/include/arch/types.h

    rc8fbbe7 r810a36f  
    3636#define KERN_ia64_TYPES_H_
    3737
    38 #include <arch/common.h>
    39 
    40 typedef uint64_t size_t;
    41 typedef int64_t ssize_t;
    42 
    43 typedef uint64_t uintptr_t;
    44 typedef uint64_t pfn_t;
    45 
    46 typedef uint64_t ipl_t;
    47 
    48 typedef uint64_t sysarg_t;
    49 typedef int64_t native_t;
    50 typedef uint64_t atomic_count_t;
     38#include <_bits/all.h>
    5139
    5240typedef struct {
     
    5543} __attribute__((may_alias)) fncptr_t;
    5644
    57 #define PRIdn  PRId64  /**< Format for native_t. */
    58 #define PRIun  PRIu64  /**< Format for sysarg_t. */
    59 #define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
    60 #define PRIua  PRIu64  /**< Format for atomic_count_t. */
    61 
    6245#endif
    6346
  • kernel/arch/ia64/src/interrupt.c

    rc8fbbe7 r810a36f  
    142142            istate->cr_isr.value, istate->cr_ipsr.value);
    143143       
    144         printf("cr.iip=%#0" PRIx64 ", #%u\t(%s)\n",
     144        printf("cr.iip=%#0" PRIxPTR ", #%u\t(%s)\n",
    145145            istate->cr_iip, istate->cr_isr.ei,
    146146            symtab_fmt_name_lookup(istate->cr_iip));
    147         printf("cr.iipa=%#0" PRIx64 "\t(%s)\n", istate->cr_iipa,
     147        printf("cr.iipa=%#0" PRIxPTR "\t(%s)\n", istate->cr_iipa,
    148148            symtab_fmt_name_lookup(istate->cr_iipa));
    149         printf("cr.ifa=%#0" PRIx64 "\t(%s)\n", istate->cr_ifa,
     149        printf("cr.ifa=%#0" PRIxPTR "\t(%s)\n", istate->cr_ifa,
    150150            symtab_fmt_name_lookup(istate->cr_ifa));
    151151}
  • kernel/arch/mips32/include/arch/types.h

    rc8fbbe7 r810a36f  
    3636#define KERN_mips32_TYPES_H_
    3737
    38 #include <arch/common.h>
    39 
    40 typedef uint32_t size_t;
    41 typedef int32_t ssize_t;
    42 
    43 typedef uint32_t uintptr_t;
    44 typedef uint32_t pfn_t;
    45 
    46 typedef uint32_t ipl_t;
    47 
    48 typedef uint32_t sysarg_t;
    49 typedef int32_t native_t;
    50 typedef uint32_t atomic_count_t;
     38#include <_bits/all.h>
    5139
    5240typedef struct {
    5341} fncptr_t;
    54 
    55 #define PRIdn  PRId32  /**< Format for native_t. */
    56 #define PRIun  PRIu32  /**< Format for sysarg_t. */
    57 #define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
    58 #define PRIua  PRIu32  /**< Format for atomic_count_t. */
    5942
    6043#endif
  • kernel/arch/ppc32/include/arch/types.h

    rc8fbbe7 r810a36f  
    3636#define KERN_ppc32_TYPES_H_
    3737
    38 #include <arch/common.h>
    39 
    40 typedef uint32_t size_t;
    41 typedef int32_t ssize_t;
    42 
    43 typedef uint32_t uintptr_t;
    44 typedef uint32_t pfn_t;
    45 
    46 typedef uint32_t ipl_t;
    47 
    48 typedef uint32_t sysarg_t;
    49 typedef int32_t native_t;
    50 typedef uint32_t atomic_count_t;
     38#include <_bits/all.h>
    5139
    5240typedef struct {
    5341} fncptr_t;
    54 
    55 #define PRIdn  PRId32  /**< Format for native_t. */
    56 #define PRIun  PRIu32  /**< Format for sysarg_t. */
    57 #define PRIxn  PRIx32  /**< Format for hexadecimal sysarg_t. */
    58 #define PRIua  PRIu32  /**< Format for atomic_count_t. */
    5942
    6043#endif
  • kernel/arch/riscv64/include/arch/types.h

    rc8fbbe7 r810a36f  
    3636#define KERN_riscv64_TYPES_H_
    3737
    38 #include <arch/common.h>
    39 
    40 typedef uint64_t size_t;
    41 typedef int64_t ssize_t;
    42 
    43 typedef uint64_t uintptr_t;
    44 typedef uint64_t pfn_t;
    45 
    46 typedef uint64_t ipl_t;
    47 
    48 typedef uint64_t sysarg_t;
    49 typedef int64_t native_t;
    50 typedef uint64_t atomic_count_t;
     38#include <_bits/all.h>
    5139
    5240typedef struct {
    5341} fncptr_t;
    54 
    55 #define PRIdn  PRId64  /**< Format for native_t. */
    56 #define PRIun  PRIu64  /**< Format for sysarg_t. */
    57 #define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
    58 #define PRIua  PRIu64  /**< Format for atomic_count_t. */
    5942
    6043#endif
  • kernel/arch/sparc64/include/arch/asm.h

    rc8fbbe7 r810a36f  
    350350       
    351351        pstate.value = pstate_read();
    352         pstate.ie = ((pstate_reg_t) ipl).ie;
     352        pstate.ie = ((pstate_reg_t)(uint64_t) ipl).ie;
    353353        pstate_write(pstate.value);
    354354}
  • kernel/arch/sparc64/include/arch/barrier.h

    rc8fbbe7 r810a36f  
    3737
    3838#include <trace.h>
    39 
    40 #ifdef KERNEL
    41 #include <arch/common.h>
    42 #else
    43 #include <libarch/common.h>
    44 #endif
    4539
    4640/*
     
    8882NO_TRACE static inline void flush_pipeline(void)
    8983{
    90         uint64_t pc;
     84        unsigned long pc;
    9185       
    9286        /*
  • kernel/arch/sparc64/include/arch/mm/sun4v/tsb.h

    rc8fbbe7 r810a36f  
    7272struct pte;
    7373
    74 extern void tsb_invalidate(struct as *as, uintptr_t page, uint64_t pages);
     74extern void tsb_invalidate(struct as *as, uintptr_t page, size_t pages);
    7575extern void itsb_pte_copy(struct pte *t);
    7676extern void dtsb_pte_copy(struct pte *t, bool ro);
  • kernel/arch/sparc64/include/arch/types.h

    rc8fbbe7 r810a36f  
    3636#define KERN_sparc64_TYPES_H_
    3737
    38 #include <arch/common.h>
    39 
    40 typedef uint64_t size_t;
    41 typedef int64_t ssize_t;
    42 
    43 typedef uint64_t uintptr_t;
    44 typedef uint64_t pfn_t;
    45 
    46 typedef uint64_t ipl_t;
    47 
    48 typedef uint64_t sysarg_t;
    49 typedef int64_t native_t;
    50 typedef uint64_t atomic_count_t;
     38#include <_bits/all.h>
    5139
    5240typedef struct {
     
    5543typedef uint8_t asi_t;
    5644
    57 #define PRIdn  PRId64  /**< Format for native_t. */
    58 #define PRIun  PRIu64  /**< Format for sysarg_t. */
    59 #define PRIxn  PRIx64  /**< Format for hexadecimal sysarg_t. */
    60 #define PRIua  PRIu64  /**< Format for atomic_count_t. */
    61 
    6245#endif
    6346
  • kernel/generic/include/stddef.h

    rc8fbbe7 r810a36f  
    3838#include <arch/types.h>
    3939
    40 typedef native_t ptrdiff_t;
    41 
    42 #ifndef NULL
    43         #define NULL  ((void *) 0)
    44 #endif
     40#include <_bits/NULL.h>
    4541
    4642#define offsetof(type,member) ((size_t) &(((type *) 0)->member))
  • kernel/generic/include/stdint.h

    rc8fbbe7 r810a36f  
    3636#define KERN_STDINT_H_
    3737
    38 #include <arch/common.h>
    39 
    40 #define INT8_MIN  INT8_C(0x80)
    41 #define INT8_MAX  INT8_C(0x7F)
    42 
    43 #define UINT8_MIN  UINT8_C(0)
    44 #define UINT8_MAX  UINT8_C(0xFF)
    45 
    46 #define INT16_MIN  INT16_C(0x8000)
    47 #define INT16_MAX  INT16_C(0x7FFF)
    48 
    49 #define UINT16_MIN  UINT16_C(0)
    50 #define UINT16_MAX  UINT16_C(0xFFFF)
    51 
    52 #define INT32_MIN  INT32_C(0x80000000)
    53 #define INT32_MAX  INT32_C(0x7FFFFFFF)
    54 
    55 #define UINT32_MIN  UINT32_C(0)
    56 #define UINT32_MAX  UINT32_C(0xFFFFFFFF)
    57 
    58 #define INT64_MIN  INT64_C(0x8000000000000000)
    59 #define INT64_MAX  INT64_C(0x7FFFFFFFFFFFFFFF)
    60 
    61 #define UINT64_MIN  UINT64_C(0)
    62 #define UINT64_MAX  UINT64_C(0xFFFFFFFFFFFFFFFF)
     38#include <_bits/stdint.h>
    6339
    6440#endif
  • kernel/generic/include/typedefs.h

    rc8fbbe7 r810a36f  
    3636#define KERN_TYPEDEFS_H_
    3737
    38 #include <stdint.h>
    39 #include <arch/common.h>
    4038#include <arch/types.h>
    4139
  • kernel/generic/src/debug/panic.c

    rc8fbbe7 r810a36f  
    6262                printf("\n");
    6363        } else if (cat == PANIC_BADTRAP) {
    64                 printf("bad trap %" PRIun ". %s\n", address,
     64                printf("bad trap %" PRIuPTR ". %s\n", address,
    6565                    BANNER_RIGHT);
    6666                if (fmt) {
     
    9696        printf("THE=%p: ", THE);
    9797        if (THE != NULL) {
    98                 printf("pe=%" PRIun " thread=%p task=%p cpu=%p as=%p"
     98                printf("pe=%" PRIuPTR " thread=%p task=%p cpu=%p as=%p"
    9999                    " magic=%#" PRIx32 "\n", THE->preemption,
    100100                    THE->thread, THE->task, THE->cpu, THE->as, THE->magic);
  • kernel/generic/src/lib/ra.c

    rc8fbbe7 r810a36f  
    353353        link = hash_table_find(&span->used, &key);
    354354        if (!link) {
    355                 panic("Freeing segment which is not known to be used (base=%"
    356                     PRIxn ", size=%" PRIdn ").", base, size);
     355                panic("Freeing segment which is not known to be used (base=%zx"
     356                    ", size=%zd).", base, size);
    357357        }
    358358        seg = hash_table_get_inst(link, ra_segment_t, uh_link);
     
    447447        irq_spinlock_unlock(&arena->lock, true);
    448448
    449         panic("Freeing to wrong arena (base=%" PRIxn ", size=%" PRIdn ").",
     449        panic("Freeing to wrong arena (base=%" PRIxPTR ", size=%zd).",
    450450            base, size);
    451451}
  • kernel/generic/src/lib/str.c

    rc8fbbe7 r810a36f  
    114114
    115115/** Check the condition if wchar_t is signed */
    116 #ifdef WCHAR_IS_UNSIGNED
     116#ifdef __WCHAR_UNSIGNED__
    117117        #define WCHAR_SIGNED_CHECK(cond)  (true)
    118118#else
  • kernel/generic/src/mm/backend_user.c

    rc8fbbe7 r810a36f  
    129129        if (rc != EOK) {
    130130                log(LF_USPACE, LVL_FATAL,
    131                     "Page-in request for page %#" PRIxn
     131                    "Page-in request for page %#" PRIxPTR
    132132                    " at pager %d failed with error %d.",
    133133                    upage, pager_info->pager, rc);
  • kernel/generic/src/printf/printf_core.c

    rc8fbbe7 r810a36f  
    104104        PrintfQualifierLongLong,
    105105        PrintfQualifierPointer,
    106         PrintfQualifierSize
     106        PrintfQualifierSize,
     107        PrintfQualifierMax
    107108} qualifier_t;
    108109
     
    767768                        case 'z':
    768769                                qualifier = PrintfQualifierSize;
     770                                i = nxt;
     771                                uc = str_decode(fmt, &nxt, STR_NO_LIMIT);
     772                                break;
     773                        case 'j':
     774                                qualifier = PrintfQualifierMax;
    769775                                i = nxt;
    770776                                uc = str_decode(fmt, &nxt, STR_NO_LIMIT);
     
    892898                                number = (uint64_t) va_arg(ap, size_t);
    893899                                break;
     900                        case PrintfQualifierMax:
     901                                size = sizeof(uintmax_t);
     902                                number = (uint64_t) va_arg(ap, uintmax_t);
     903                                break;
    894904                        default:
    895905                                /* Unknown qualifier */
  • tools/autotool.py

    rc8fbbe7 r810a36f  
    1 #!/usr/bin/env python
     1#!/usr/bin/env python2
    22#
    33# Copyright (c) 2010 Martin Decky
     
    4343MAKEFILE = 'Makefile.common'
    4444HEADER = 'common.h.new'
    45 GUARD = 'AUTOTOOL_COMMON_H_'
     45GUARD = '_AUTOTOOL_COMMON_H_'
    4646
    4747PROBE_SOURCE = 'probe.c'
    4848PROBE_OUTPUT = 'probe.s'
    49 
    50 PROBE_INT128_SOURCE = 'probe_int128.c'
    51 PROBE_INT128_OUTPUT = 'probe_int128.s'
    5249
    5350PACKAGE_BINUTILS = "usually part of binutils"
     
    5956COMPILER_WARNING = "The compilation of HelenOS might fail."
    6057
    61 PROBE_HEAD = """#define AUTOTOOL_DECLARE(category, subcategory, tag, name, strc, conc, value) \\
     58PROBE_HEAD = """#define AUTOTOOL_DECLARE(category, tag, name, signedness, base, size, compatible) \\
    6259        asm volatile ( \\
    63                 "AUTOTOOL_DECLARE\\t" category "\\t" subcategory "\\t" tag "\\t" name "\\t" strc "\\t" conc "\\t%[val]\\n" \\
     60                "AUTOTOOL_DECLARE\\t" category "\\t" tag "\\t" name "\\t" signedness "\\t" base "\\t%[size_val]\\t%[cmp_val]\\n" \\
    6461                : \\
    65                 : [val] "n" (value) \\
     62                : [size_val] "n" (size), [cmp_val] "n" (compatible) \\
    6663        )
    6764
     
    7067
    7168#define DECLARE_BUILTIN_TYPE(tag, type) \\
    72         AUTOTOOL_DECLARE("builtin_size", "", tag, STRING(type), "", "", sizeof(type)); \\
    73         AUTOTOOL_DECLARE("builtin_sign", "unsigned long long int", tag, STRING(type), "unsigned", "", __builtin_types_compatible_p(type, unsigned long long int)); \\
    74         AUTOTOOL_DECLARE("builtin_sign", "unsigned long int", tag, STRING(type), "unsigned", "", __builtin_types_compatible_p(type, unsigned long int)); \\
    75         AUTOTOOL_DECLARE("builtin_sign", "unsigned int", tag, STRING(type), "unsigned", "", __builtin_types_compatible_p(type, unsigned int)); \\
    76         AUTOTOOL_DECLARE("builtin_sign", "unsigned short int", tag, STRING(type), "unsigned", "", __builtin_types_compatible_p(type, unsigned short int)); \\
    77         AUTOTOOL_DECLARE("builtin_sign", "unsigned char", tag, STRING(type), "unsigned", "", __builtin_types_compatible_p(type, unsigned char)); \\
    78         AUTOTOOL_DECLARE("builtin_sign", "signed long long int", tag, STRING(type), "signed", "", __builtin_types_compatible_p(type, signed long long int)); \\
    79         AUTOTOOL_DECLARE("builtin_sign", "signed long int", tag, STRING(type), "signed", "", __builtin_types_compatible_p(type, signed long int)); \\
    80         AUTOTOOL_DECLARE("builtin_sign", "signed int", tag, STRING(type), "signed", "", __builtin_types_compatible_p(type, signed int)); \\
    81         AUTOTOOL_DECLARE("builtin_sign", "signed short int", tag, STRING(type), "signed", "", __builtin_types_compatible_p(type, signed short int)); \\
    82         AUTOTOOL_DECLARE("builtin_sign", "signed char", tag, STRING(type), "signed", "", __builtin_types_compatible_p(type, signed char));
    83 
    84 #define DECLARE_INTSIZE(tag, type, strc, conc) \\
    85         AUTOTOOL_DECLARE("intsize", "unsigned", tag, #type, strc, conc, sizeof(unsigned type)); \\
    86         AUTOTOOL_DECLARE("intsize", "signed", tag, #type, strc, conc, sizeof(signed type));
    87 
    88 #define DECLARE_FLOATSIZE(tag, type) \\
    89         AUTOTOOL_DECLARE("floatsize", "", tag, #type, "", "", sizeof(type));
    90 
    91 extern int main(int, char *[]);
    92 
    93 int main(int argc, char *argv[])
    94 {
    95 #ifdef __SIZE_TYPE__
    96         DECLARE_BUILTIN_TYPE("size", __SIZE_TYPE__);
    97 #endif
    98 #ifdef __WCHAR_TYPE__
    99         DECLARE_BUILTIN_TYPE("wchar", __WCHAR_TYPE__);
    100 #endif
    101 #ifdef __WINT_TYPE__
    102         DECLARE_BUILTIN_TYPE("wint", __WINT_TYPE__);
    103 #endif
    104 """
    105 
    106 PROBE_TAIL = """}
    107 """
    108 
    109 PROBE_INT128_HEAD = """#define AUTOTOOL_DECLARE(category, subcategory, tag, name, strc, conc, value) \\
    110         asm volatile ( \\
    111                 "AUTOTOOL_DECLARE\\t" category "\\t" subcategory "\\t" tag "\\t" name "\\t" strc "\\t" conc "\\t%[val]\\n" \\
    112                 : \\
    113                 : [val] "n" (value) \\
    114         )
    115 
    116 #define DECLARE_INTSIZE(tag, type) \\
    117         AUTOTOOL_DECLARE("intsize", "unsigned", tag, #type, "", "", sizeof(unsigned type)); \\
    118         AUTOTOOL_DECLARE("intsize", "signed", tag, #type, "", "", sizeof(signed type));
     69        AUTOTOOL_DECLARE("unsigned long long int", tag, STRING(type), "unsigned", "long long", sizeof(type), __builtin_types_compatible_p(type, unsigned long long int)); \\
     70        AUTOTOOL_DECLARE("unsigned long int", tag, STRING(type), "unsigned", "long", sizeof(type), __builtin_types_compatible_p(type, unsigned long int)); \\
     71        AUTOTOOL_DECLARE("unsigned int", tag, STRING(type), "unsigned", "int", sizeof(type), __builtin_types_compatible_p(type, unsigned int)); \\
     72        AUTOTOOL_DECLARE("unsigned short int", tag, STRING(type), "unsigned", "short", sizeof(type), __builtin_types_compatible_p(type, unsigned short int)); \\
     73        AUTOTOOL_DECLARE("unsigned char", tag, STRING(type), "unsigned", "char", sizeof(type), __builtin_types_compatible_p(type, unsigned char)); \\
     74        AUTOTOOL_DECLARE("signed long long int", tag, STRING(type), "signed", "long long", sizeof(type), __builtin_types_compatible_p(type, signed long long int)); \\
     75        AUTOTOOL_DECLARE("signed long int", tag, STRING(type), "signed", "long", sizeof(type), __builtin_types_compatible_p(type, signed long int)); \\
     76        AUTOTOOL_DECLARE("signed int", tag, STRING(type), "signed", "int", sizeof(type), __builtin_types_compatible_p(type, signed int)); \\
     77        AUTOTOOL_DECLARE("signed short int", tag, STRING(type), "signed", "short", sizeof(type), __builtin_types_compatible_p(type, signed short int)); \\
     78        AUTOTOOL_DECLARE("signed char", tag, STRING(type), "signed", "char", sizeof(type), __builtin_types_compatible_p(type, signed char)); \\
     79        AUTOTOOL_DECLARE("pointer", tag, STRING(type), "N/A", "pointer", sizeof(type), __builtin_types_compatible_p(type, void*)); \\
     80        AUTOTOOL_DECLARE("long double", tag, STRING(type), "signed", "long double", sizeof(type), __builtin_types_compatible_p(type, long double)); \\
     81        AUTOTOOL_DECLARE("double", tag, STRING(type), "signed", "double", sizeof(type), __builtin_types_compatible_p(type, double)); \\
     82        AUTOTOOL_DECLARE("float", tag, STRING(type), "signed", "float", sizeof(type), __builtin_types_compatible_p(type, float));
    11983
    12084extern int main(int, char *[]);
     
    12488"""
    12589
    126 PROBE_INT128_TAIL = """}
     90PROBE_TAIL = """}
    12791"""
    12892
     
    414378        return int(value, base)
    415379
    416 def probe_compiler(common, intsizes, floatsizes):
     380def probe_compiler(common, typesizes):
    417381        "Generate, compile and parse probing source"
    418382       
     
    422386        outf.write(PROBE_HEAD)
    423387       
    424         for typedef in intsizes:
    425                 outf.write("\tDECLARE_INTSIZE(\"%s\", %s, %s, %s);\n" % (typedef['tag'], typedef['type'], typedef['strc'], typedef['conc']))
    426        
    427         for typedef in floatsizes:
    428                 outf.write("\tDECLARE_FLOATSIZE(\"%s\", %s);\n" % (typedef['tag'], typedef['type']))
     388        for typedef in typesizes:
     389                if 'def' in typedef:
     390                        outf.write("#ifdef %s\n" % typedef['def'])
     391                outf.write("\tDECLARE_BUILTIN_TYPE(\"%s\", %s);\n" % (typedef['tag'], typedef['type']))
     392                if 'def' in typedef:
     393                        outf.write("#endif\n")
    429394       
    430395        outf.write(PROBE_TAIL)
     
    457422        inf.close()
    458423       
    459         unsigned_sizes = {}
    460         signed_sizes = {}
    461        
    462         unsigned_tags = {}
    463         signed_tags = {}
    464        
    465         unsigned_strcs = {}
    466         signed_strcs = {}
    467        
    468         unsigned_concs = {}
    469         signed_concs = {}
    470        
    471         float_tags = {}
    472        
    473         builtin_sizes = {}
    474         builtin_signs = {}
     424        builtins = {}
    475425       
    476426        for j in range(len(lines)):
     
    479429                if (len(tokens) > 0):
    480430                        if (tokens[0] == "AUTOTOOL_DECLARE"):
    481                                 if (len(tokens) < 7):
     431                                if (len(tokens) < 8):
    482432                                        print_error(["Malformed declaration in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
    483433                               
    484434                                category = tokens[1]
    485                                 subcategory = tokens[2]
    486                                 tag = tokens[3]
    487                                 name = tokens[4]
    488                                 strc = tokens[5]
    489                                 conc = tokens[6]
    490                                 value = tokens[7]
     435                                tag = tokens[2]
     436                                name = tokens[3]
     437                                signedness = tokens[4]
     438                                base = tokens[5]
     439                                size = tokens[6]
     440                                compatible = tokens[7]
    491441                               
    492                                 if (category == "intsize"):
    493                                         try:
    494                                                 value_int = decode_value(value)
    495                                         except:
    496                                                 print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
    497                                        
    498                                         if (subcategory == "unsigned"):
    499                                                 unsigned_sizes[value_int] = name
    500                                                 unsigned_tags[tag] = value_int
    501                                                 unsigned_strcs[value_int] = strc
    502                                                 unsigned_concs[value_int] = conc
    503                                         elif (subcategory == "signed"):
    504                                                 signed_sizes[value_int] = name
    505                                                 signed_tags[tag] = value_int
    506                                                 signed_strcs[value_int] = strc
    507                                                 signed_concs[value_int] = conc
    508                                         else:
    509                                                 print_error(["Unexpected keyword \"%s\" in \"%s\" on line %s." % (subcategory, PROBE_OUTPUT, j), COMPILER_FAIL])
     442                                try:
     443                                        compatible_int = decode_value(compatible)
     444                                        size_int = decode_value(size)
     445                                except:
     446                                        print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
    510447                               
    511                                 if (category == "floatsize"):
    512                                         try:
    513                                                 value_int = decode_value(value)
    514                                         except:
    515                                                 print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
    516                                        
    517                                         float_tags[tag] = value_int
    518                                
    519                                 if (category == "builtin_size"):
    520                                         try:
    521                                                 value_int = decode_value(value)
    522                                         except:
    523                                                 print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
    524                                        
    525                                         builtin_sizes[tag] = {'name': name, 'value': value_int}
    526                                
    527                                 if (category == "builtin_sign"):
    528                                         try:
    529                                                 value_int = decode_value(value)
    530                                         except:
    531                                                 print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
    532                                        
    533                                         if (value_int == 1):
    534                                                 if (not tag in builtin_signs):
    535                                                         builtin_signs[tag] = strc;
    536                                                 elif (builtin_signs[tag] != strc):
    537                                                         print_error(["Inconsistent builtin type detection in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL])
    538        
    539         return {'unsigned_sizes': unsigned_sizes, 'signed_sizes': signed_sizes, 'unsigned_tags': unsigned_tags, 'signed_tags': signed_tags, 'unsigned_strcs': unsigned_strcs, 'signed_strcs': signed_strcs, 'unsigned_concs': unsigned_concs, 'signed_concs': signed_concs, 'float_tags': float_tags, 'builtin_sizes': builtin_sizes, 'builtin_signs': builtin_signs}
    540 
    541 def probe_int128(common):
    542         "Generate, compile and parse probing source for 128-bit integers"
    543        
    544         check_common(common, "CC")
    545        
    546         outf = open(PROBE_INT128_SOURCE, 'w')
    547         outf.write(PROBE_INT128_HEAD)
    548         outf.write("\tDECLARE_INTSIZE(\"INT128\", int __attribute((mode(TI))));\n")
    549         outf.write(PROBE_INT128_TAIL)
    550         outf.close()
    551        
    552         args = common['CC_AUTOGEN'].split(' ')
    553         args.extend(["-S", "-o", PROBE_INT128_OUTPUT, PROBE_INT128_SOURCE])
    554        
    555         try:
    556                 sys.stderr.write("Checking whether the compiler has intrinsic support for 128-bit integers ... ")
    557                 output = subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.PIPE).communicate()
    558         except:
    559                 sys.stderr.write("no\n")
    560                 return False
    561        
    562         if (not os.path.isfile(PROBE_INT128_OUTPUT)):
    563                 sys.stderr.write("no\n")
    564                 return False
    565        
    566         inf = open(PROBE_INT128_OUTPUT, 'r')
    567         lines = inf.readlines()
    568         inf.close()
    569        
    570         for j in range(len(lines)):
    571                 tokens = lines[j].strip().split("\t")
    572                
    573                 if (len(tokens) > 0):
    574                         if (tokens[0] == "AUTOTOOL_DECLARE"):
    575                                 if (len(tokens) < 7):
    576                                         print_error(["Malformed declaration in \"%s\" on line %s." % (PROBE_INT128_OUTPUT, j), COMPILER_FAIL])
    577                                
    578                                 category = tokens[1]
    579                                 subcategory = tokens[2]
    580                                 tag = tokens[3]
    581                                 name = tokens[4]
    582                                 strc = tokens[5]
    583                                 conc = tokens[6]
    584                                 value = tokens[7]
    585                                
    586                                 if (category == "intsize"):
    587                                         try:
    588                                                 value_int = decode_value(value)
    589                                         except:
    590                                                 print_error(["Integer value expected in \"%s\" on line %s." % (PROBE_INT128_OUTPUT, j), COMPILER_FAIL])
    591                                        
    592                                         if (subcategory == "unsigned"):
    593                                                 if (value_int != 16):
    594                                                         sys.stderr.write("no\n")
    595                                                         return False
    596                                         elif (subcategory == "signed"):
    597                                                 if (value_int != 16):
    598                                                         sys.stderr.write("no\n")
    599                                                         return False
    600                                         else:
    601                                                 print_error(["Unexpected keyword \"%s\" in \"%s\" on line %s." % (subcategory, PROBE_INT128_OUTPUT, j), COMPILER_FAIL])
    602        
    603         sys.stderr.write("yes\n")
    604         return True
    605 
    606 def detect_sizes(probe, bytes, inttags, floattags):
    607         "Detect correct types for fixed-size types"
    608        
    609         macros = []
    610         typedefs = []
    611        
    612         for b in bytes:
    613                 if (not b in probe['unsigned_sizes']):
    614                         print_error(['Unable to find appropriate unsigned integer type for %u bytes.' % b,
    615                                      COMPILER_FAIL])
    616                
    617                 if (not b in probe['signed_sizes']):
    618                         print_error(['Unable to find appropriate signed integer type for %u bytes.' % b,
    619                                      COMPILER_FAIL])
    620                
    621                 if (not b in probe['unsigned_strcs']):
    622                         print_error(['Unable to find appropriate unsigned printf formatter for %u bytes.' % b,
    623                                      COMPILER_FAIL])
    624                
    625                 if (not b in probe['signed_strcs']):
    626                         print_error(['Unable to find appropriate signed printf formatter for %u bytes.' % b,
    627                                      COMPILER_FAIL])
    628                
    629                 if (not b in probe['unsigned_concs']):
    630                         print_error(['Unable to find appropriate unsigned literal macro for %u bytes.' % b,
    631                                      COMPILER_FAIL])
    632                
    633                 if (not b in probe['signed_concs']):
    634                         print_error(['Unable to find appropriate signed literal macro for %u bytes.' % b,
    635                                      COMPILER_FAIL])
    636                
    637                 typedefs.append({'oldtype': "unsigned %s" % probe['unsigned_sizes'][b], 'newtype': "uint%u_t" % (b * 8)})
    638                 typedefs.append({'oldtype': "signed %s" % probe['signed_sizes'][b], 'newtype': "int%u_t" % (b * 8)})
    639                
    640                 macros.append({'oldmacro': "unsigned %s" % probe['unsigned_sizes'][b], 'newmacro': "UINT%u_T" % (b * 8)})
    641                 macros.append({'oldmacro': "signed %s" % probe['signed_sizes'][b], 'newmacro': "INT%u_T" % (b * 8)})
    642                
    643                 macros.append({'oldmacro': "\"%so\"" % probe['unsigned_strcs'][b], 'newmacro': "PRIo%u" % (b * 8)})
    644                 macros.append({'oldmacro': "\"%su\"" % probe['unsigned_strcs'][b], 'newmacro': "PRIu%u" % (b * 8)})
    645                 macros.append({'oldmacro': "\"%sx\"" % probe['unsigned_strcs'][b], 'newmacro': "PRIx%u" % (b * 8)})
    646                 macros.append({'oldmacro': "\"%sX\"" % probe['unsigned_strcs'][b], 'newmacro': "PRIX%u" % (b * 8)})
    647                 macros.append({'oldmacro': "\"%sd\"" % probe['signed_strcs'][b], 'newmacro': "PRId%u" % (b * 8)})
    648                
    649                 name = probe['unsigned_concs'][b]
    650                 if ((name.startswith('@')) or (name == "")):
    651                         macros.append({'oldmacro': "c ## U", 'newmacro': "UINT%u_C(c)" % (b * 8)})
    652                 else:
    653                         macros.append({'oldmacro': "c ## U%s" % name, 'newmacro': "UINT%u_C(c)" % (b * 8)})
    654                
    655                 name = probe['unsigned_concs'][b]
    656                 if ((name.startswith('@')) or (name == "")):
    657                         macros.append({'oldmacro': "c", 'newmacro': "INT%u_C(c)" % (b * 8)})
    658                 else:
    659                         macros.append({'oldmacro': "c ## %s" % name, 'newmacro': "INT%u_C(c)" % (b * 8)})
    660        
    661         for tag in inttags:
    662                 newmacro = "U%s" % tag
    663                 if (not tag in probe['unsigned_tags']):
    664                         print_error(['Unable to find appropriate size macro for %s.' % newmacro,
    665                                      COMPILER_FAIL])
    666                
    667                 oldmacro = "UINT%s" % (probe['unsigned_tags'][tag] * 8)
    668                 macros.append({'oldmacro': "%s_MIN" % oldmacro, 'newmacro': "%s_MIN" % newmacro})
    669                 macros.append({'oldmacro': "%s_MAX" % oldmacro, 'newmacro': "%s_MAX" % newmacro})
    670                 macros.append({'oldmacro': "1", 'newmacro': 'U%s_SIZE_%s' % (tag, probe['unsigned_tags'][tag] * 8)})
    671                
    672                 newmacro = tag
    673                 if (not tag in probe['signed_tags']):
    674                         print_error(['Unable to find appropriate size macro for %s' % newmacro,
    675                                      COMPILER_FAIL])
    676                
    677                 oldmacro = "INT%s" % (probe['signed_tags'][tag] * 8)
    678                 macros.append({'oldmacro': "%s_MIN" % oldmacro, 'newmacro': "%s_MIN" % newmacro})
    679                 macros.append({'oldmacro': "%s_MAX" % oldmacro, 'newmacro': "%s_MAX" % newmacro})
    680                 macros.append({'oldmacro': "1", 'newmacro': '%s_SIZE_%s' % (tag, probe['signed_tags'][tag] * 8)})
    681        
    682         for tag in floattags:
    683                 if (not tag in probe['float_tags']):
    684                         print_error(['Unable to find appropriate size macro for %s' % tag,
    685                                      COMPILER_FAIL])
    686                
    687                 macros.append({'oldmacro': "1", 'newmacro': '%s_SIZE_%s' % (tag, probe['float_tags'][tag] * 8)})
    688        
    689         if (not 'size' in probe['builtin_signs']):
    690                 print_error(['Unable to determine whether size_t is signed or unsigned.',
     448                                if (compatible_int == 1):
     449                                        builtins[tag] = {
     450                                                'tag': tag,
     451                                                'name': name,
     452                                                'sign': signedness,
     453                                                'base': base,
     454                                                'size': size_int,
     455                                        }
     456       
     457        for typedef in typesizes:
     458                if not typedef['tag'] in builtins:
     459                        print_error(['Unable to determine the properties of type %s.' % typedef['tag'],
    691460                             COMPILER_FAIL])
    692        
    693         if (probe['builtin_signs']['size'] != 'unsigned'):
    694                 print_error(['The type size_t is not unsigned.',
    695                              COMPILER_FAIL])
    696        
    697         fnd = True
    698        
    699         if (not 'wchar' in probe['builtin_sizes']):
    700                 print_warning(['The compiler does not provide the macro __WCHAR_TYPE__',
    701                                'for defining the compiler-native type wchar_t. We are',
    702                                'forced to define wchar_t as a hardwired type int32_t.',
    703                                COMPILER_WARNING])
    704                 fnd = False
    705        
    706         if (probe['builtin_sizes']['wchar']['value'] != 4):
    707                 print_warning(['The compiler provided macro __WCHAR_TYPE__ for defining',
    708                                'the compiler-native type wchar_t is not compliant with',
    709                                'HelenOS. We are forced to define wchar_t as a hardwired',
    710                                'type int32_t.',
    711                                COMPILER_WARNING])
    712                 fnd = False
    713        
    714         if (not fnd):
    715                 macros.append({'oldmacro': "int32_t", 'newmacro': "wchar_t"})
     461                if 'sname' in typedef:
     462                        builtins[typedef['tag']]['sname'] = typedef['sname']
     463       
     464        return builtins
     465
     466def get_suffix(type):
     467        if type['sign'] == 'unsigned':
     468                return {
     469                        "char": "",
     470                        "short": "",
     471                        "int": "U",
     472                        "long": "UL",
     473                        "long long": "ULL",
     474                }[type['base']]
    716475        else:
    717                 macros.append({'oldmacro': "__WCHAR_TYPE__", 'newmacro': "wchar_t"})
    718        
    719         if (not 'wchar' in probe['builtin_signs']):
    720                 print_error(['Unable to determine whether wchar_t is signed or unsigned.',
    721                              COMPILER_FAIL])
    722        
    723         if (probe['builtin_signs']['wchar'] == 'unsigned'):
    724                 macros.append({'oldmacro': "1", 'newmacro': 'WCHAR_IS_UNSIGNED'})
    725         if (probe['builtin_signs']['wchar'] == 'signed'):
    726                 macros.append({'oldmacro': "1", 'newmacro': 'WCHAR_IS_SIGNED'})
    727        
    728         fnd = True
    729        
    730         if (not 'wint' in probe['builtin_sizes']):
    731                 print_warning(['The compiler does not provide the macro __WINT_TYPE__',
    732                                'for defining the compiler-native type wint_t. We are',
    733                                'forced to define wint_t as a hardwired type int32_t.',
    734                                COMPILER_WARNING])
    735                 fnd = False
    736        
    737         if (probe['builtin_sizes']['wint']['value'] != 4):
    738                 print_warning(['The compiler provided macro __WINT_TYPE__ for defining',
    739                                'the compiler-native type wint_t is not compliant with',
    740                                'HelenOS. We are forced to define wint_t as a hardwired',
    741                                'type int32_t.',
    742                                COMPILER_WARNING])
    743                 fnd = False
    744        
    745         if (not fnd):
    746                 macros.append({'oldmacro': "int32_t", 'newmacro': "wint_t"})
    747         else:
    748                 macros.append({'oldmacro': "__WINT_TYPE__", 'newmacro': "wint_t"})
    749        
    750         if (not 'wint' in probe['builtin_signs']):
    751                 print_error(['Unable to determine whether wint_t is signed or unsigned.',
    752                              COMPILER_FAIL])
    753        
    754         if (probe['builtin_signs']['wint'] == 'unsigned'):
    755                 macros.append({'oldmacro': "1", 'newmacro': 'WINT_IS_UNSIGNED'})
    756         if (probe['builtin_signs']['wint'] == 'signed'):
    757                 macros.append({'oldmacro': "1", 'newmacro': 'WINT_IS_SIGNED'})
    758        
    759         return {'macros': macros, 'typedefs': typedefs}
     476                return {
     477                        "char": "",
     478                        "short": "",
     479                        "int": "",
     480                        "long": "L",
     481                        "long long": "LL",
     482                }[type['base']]
     483
     484def get_max(type):
     485        val = (1 << (type['size']*8 - 1))
     486        if type['sign'] == 'unsigned':
     487                val *= 2
     488        return val - 1
     489
     490def detect_sizes(probe):
     491        "Detect properties of builtin types"
     492       
     493        macros = {}
     494       
     495        for type in probe.values():
     496                macros['__SIZEOF_%s__' % type['tag']] = type['size']
     497               
     498                if ('sname' in type):
     499                        macros['__%s_TYPE__'  % type['sname']] = type['name']
     500                        macros['__%s_WIDTH__' % type['sname']] = type['size']*8
     501                        macros['__%s_%s__' % (type['sname'], type['sign'].upper())] = "1"
     502                        macros['__%s_C_SUFFIX__' % type['sname']] = get_suffix(type)
     503                        macros['__%s_MAX__' % type['sname']] = "%d%s" % (get_max(type), get_suffix(type))
     504       
     505        if (probe['SIZE_T']['sign'] != 'unsigned'):
     506                print_error(['The type size_t is not unsigned.', COMPILER_FAIL])
     507       
     508        return macros
    760509
    761510def create_makefile(mkname, common):
     
    777526        outmk.close()
    778527
    779 def create_header(hdname, maps, int128):
     528def create_header(hdname, macros):
    780529        "Create header output"
    781530       
     
    790539        outhd.write('#define %s\n\n' % GUARD)
    791540       
    792         for macro in maps['macros']:
    793                 outhd.write('#define %s  %s\n' % (macro['newmacro'], macro['oldmacro']))
    794        
    795         outhd.write('\n')
    796        
    797         for typedef in maps['typedefs']:
    798                 outhd.write('typedef %s %s;\n' % (typedef['oldtype'], typedef['newtype']))
    799        
    800         if (int128):
    801                 outhd.write('typedef unsigned int __attribute((mode(TI))) uint128_t;\n')
    802                 outhd.write('typedef signed int __attribute((mode(TI))) int128_t;\n')
     541        for macro in sorted(macros):
     542                outhd.write('#ifndef %s\n' % macro)
     543                outhd.write('#define %s  %s\n' % (macro, macros[macro]))
     544                outhd.write('#endif\n\n')
    803545       
    804546        outhd.write('\n#endif\n')
     
    916658                probe = probe_compiler(common,
    917659                        [
    918                                 {'type': 'long long int', 'tag': 'LLONG', 'strc': '"ll"', 'conc': '"LL"'},
    919                                 {'type': 'long int', 'tag': 'LONG', 'strc': '"l"', 'conc': '"L"'},
    920                                 {'type': 'int', 'tag': 'INT', 'strc': '""', 'conc': '""'},
    921                                 {'type': 'short int', 'tag': 'SHRT', 'strc': '"h"', 'conc': '"@"'},
    922                                 {'type': 'char', 'tag': 'CHAR', 'strc': '"hh"', 'conc': '"@@"'}
    923                         ],
    924                         [
     660                                {'type': 'long long int', 'tag': 'LONG_LONG', 'sname': 'LLONG' },
     661                                {'type': 'long int', 'tag': 'LONG', 'sname': 'LONG' },
     662                                {'type': 'int', 'tag': 'INT', 'sname': 'INT' },
     663                                {'type': 'short int', 'tag': 'SHORT', 'sname': 'SHRT'},
     664                                {'type': 'void*', 'tag': 'POINTER'},
    925665                                {'type': 'long double', 'tag': 'LONG_DOUBLE'},
    926666                                {'type': 'double', 'tag': 'DOUBLE'},
    927                                 {'type': 'float', 'tag': 'FLOAT'}
     667                                {'type': 'float', 'tag': 'FLOAT'},
     668                                {'type': '__SIZE_TYPE__', 'tag': 'SIZE_T', 'def': '__SIZE_TYPE__', 'sname': 'SIZE' },
     669                                {'type': '__PTRDIFF_TYPE__', 'tag': 'PTRDIFF_T', 'def': '__PTRDIFF_TYPE__', 'sname': 'PTRDIFF' },
     670                                {'type': '__WINT_TYPE__', 'tag': 'WINT_T', 'def': '__WINT_TYPE__', 'sname': 'WINT' },
     671                                {'type': '__WCHAR_TYPE__', 'tag': 'WCHAR_T', 'def': '__WCHAR_TYPE__', 'sname': 'WCHAR' },
     672                                {'type': '__INTMAX_TYPE__', 'tag': 'INTMAX_T', 'def': '__INTMAX_TYPE__', 'sname': 'INTMAX' },
     673                                {'type': 'unsigned __INTMAX_TYPE__', 'tag': 'UINTMAX_T', 'def': '__INTMAX_TYPE__', 'sname': 'UINTMAX' },
    928674                        ]
    929675                )
    930676               
    931                 int128 = probe_int128(common)
    932                
    933                 maps = detect_sizes(probe, [1, 2, 4, 8], ['CHAR', 'SHRT', 'INT', 'LONG', 'LLONG'], ['LONG_DOUBLE', 'DOUBLE', 'FLOAT'])
     677                macros = detect_sizes(probe)
    934678               
    935679        finally:
     
    939683       
    940684        create_makefile(MAKEFILE, common)
    941         create_header(HEADER, maps, int128)
     685        create_header(HEADER, macros)
    942686       
    943687        return 0
  • uspace/app/edit/search.c

    rc8fbbe7 r810a36f  
    3535 */
    3636
     37#include <errno.h>
    3738#include <stdlib.h>
    3839#include <stddef.h>
    39 #include <errno.h>
     40#include <types/common.h>
    4041
    4142#include "search.h"
  • uspace/app/tester/float/softfloat1.c

    rc8fbbe7 r810a36f  
    3131#include <stdbool.h>
    3232#include <stddef.h>
     33#include <inttypes.h>
    3334#include <mathtypes.h>
    3435#include <add.h>
  • uspace/app/tester/print/print4.c

    rc8fbbe7 r810a36f  
    2929#include <stdio.h>
    3030#include <stddef.h>
     31#include <wchar.h>
    3132#include "../tester.h"
    3233
  • uspace/app/tester/util.h

    rc8fbbe7 r810a36f  
    3737
    3838#include <stdio.h>
     39#include <inttypes.h>
    3940#include "tester.h"
    4041
  • uspace/lib/bithenge/src/print.c

    rc8fbbe7 r810a36f  
    4040#include <stdarg.h>
    4141#include <stdio.h>
     42#include <wchar.h>
    4243#include <bithenge/blob.h>
    4344#include <bithenge/print.h>
  • uspace/lib/c/Makefile

    rc8fbbe7 r810a36f  
    3232
    3333CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
    34 COMMON_HEADER_ARCH = arch/$(UARCH)/include/libarch/common.h
    3534
    3635LINKER_SCRIPTS = \
     
    4039        $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld
    4140
    42 PRE_DEPEND = $(COMMON_HEADER_ARCH)
     41PRE_DEPEND =
    4342EXTRA_OUTPUT = $(LINKER_SCRIPTS)
    44 EXTRA_CLEAN = $(COMMON_HEADER_ARCH) $(LINKER_SCRIPTS)
     43EXTRA_CLEAN = $(LINKER_SCRIPTS)
    4544LIBRARY = libc
    4645SLIBRARY = libc.so.0.0
     
    208207$(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
    209208        $(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DDLEXE -E -x c $< | grep -v "^\#" > $@
    210 
    211 $(COMMON_HEADER_ARCH): $(COMMON_HEADER)
    212         ln -sfn ../../../../$< $@
  • uspace/lib/c/arch/ia64/include/libarch/faddr.h

    rc8fbbe7 r810a36f  
    3838#include <types/common.h>
    3939
     40typedef struct {
     41        uintptr_t fnc;
     42        uintptr_t gp;
     43} __attribute__((may_alias)) fncptr_t;
     44
    4045/**
    4146 *
  • uspace/lib/c/generic/double_to_str.c

    rc8fbbe7 r810a36f  
    3232#include <ieee_double.h>
    3333
     34#include <limits.h>
    3435#include <stdint.h>
    3536#include <stdbool.h>
  • uspace/lib/c/generic/gsort.c

    rc8fbbe7 r810a36f  
    4141
    4242#include <gsort.h>
     43#include <inttypes.h>
    4344#include <mem.h>
    4445#include <malloc.h>
  • uspace/lib/c/generic/inet/addr.c

    rc8fbbe7 r810a36f  
    4141#include <malloc.h>
    4242#include <bitops.h>
     43#include <inttypes.h>
    4344
    4445#define INET_PREFIXSTRSIZE  5
  • uspace/lib/c/generic/io/printf_core.c

    rc8fbbe7 r810a36f  
    4646#include <assert.h>
    4747#include <macros.h>
     48#include <wchar.h>
    4849
    4950
     
    114115        PrintfQualifierLongLong,
    115116        PrintfQualifierPointer,
    116         PrintfQualifierSize
     117        PrintfQualifierSize,
     118        PrintfQualifierMax
    117119} qualifier_t;
    118120
     
    14841486                                uc = str_decode(fmt, &nxt, STR_NO_LIMIT);
    14851487                                break;
     1488                        case 'j':
     1489                                qualifier = PrintfQualifierMax;
     1490                                i = nxt;
     1491                                uc = str_decode(fmt, &nxt, STR_NO_LIMIT);
     1492                                break;
    14861493                        default:
    14871494                                /* Default type */
     
    16291636                                number = (uint64_t) va_arg(ap, size_t);
    16301637                                break;
     1638                        case PrintfQualifierMax:
     1639                                size = sizeof(uintmax_t);
     1640                                number = (uint64_t) va_arg(ap, uintmax_t);
     1641                                break;
    16311642                        default:
    16321643                                /* Unknown qualifier */
  • uspace/lib/c/generic/str.c

    rc8fbbe7 r810a36f  
    4646#include <align.h>
    4747#include <mem.h>
     48#include <limits.h>
    4849
    4950/** Check the condition if wchar_t is signed */
    50 #ifdef WCHAR_IS_UNSIGNED
     51#ifdef __WCHAR_UNSIGNED__
    5152        #define WCHAR_SIGNED_CHECK(cond)  (true)
    5253#else
  • uspace/lib/c/include/inttypes.h

    rc8fbbe7 r810a36f  
    3636#define LIBC_INTTYPES_H_
    3737
    38 #include <libarch/inttypes.h>
     38#include <_bits/inttypes.h>
    3939
    4040#endif
  • uspace/lib/c/include/io/charfield.h

    rc8fbbe7 r810a36f  
    3838
    3939#include <stdbool.h>
     40#include <wchar.h>
    4041#include <io/color.h>
    4142#include <io/style.h>
  • uspace/lib/c/include/limits.h

    rc8fbbe7 r810a36f  
    3636#define LIBC_LIMITS_H_
    3737
    38 /* XXX Make this more accurate */
    39 #include <stdint.h>
    40 #include <libarch/stdint.h>
     38#include <_bits/limits.h>
    4139
    4240#endif
  • uspace/lib/c/include/stddef.h

    rc8fbbe7 r810a36f  
    3636#define LIBC_STDDEF_H_
    3737
    38 #include <libarch/stddef.h>
     38#include <_bits/size_t.h>
     39#include <_bits/ptrdiff_t.h>
     40#include <_bits/wchar_t.h>
    3941
    40 #ifndef NULL
    41         #define NULL  ((void *) 0)
    42 #endif
     42#include <_bits/NULL.h>
    4343
    4444#define offsetof(type, member) \
  • uspace/lib/c/include/stdint.h

    rc8fbbe7 r810a36f  
    3636#define LIBC_STDINT_H_
    3737
    38 #define INT8_MIN  INT8_C(0x80)
    39 #define INT8_MAX  INT8_C(0x7F)
    40 
    41 #define UINT8_MIN  UINT8_C(0)
    42 #define UINT8_MAX  UINT8_C(0xFF)
    43 
    44 #define INT16_MIN  INT16_C(0x8000)
    45 #define INT16_MAX  INT16_C(0x7FFF)
    46 
    47 #define UINT16_MIN  UINT16_C(0)
    48 #define UINT16_MAX  UINT16_C(0xFFFF)
    49 
    50 #define INT32_MIN  INT32_C(0x80000000)
    51 #define INT32_MAX  INT32_C(0x7FFFFFFF)
    52 
    53 #define UINT32_MIN  UINT32_C(0)
    54 #define UINT32_MAX  UINT32_C(0xFFFFFFFF)
    55 
    56 #define INT64_MIN  INT64_C(0x8000000000000000)
    57 #define INT64_MAX  INT64_C(0x7FFFFFFFFFFFFFFF)
    58 
    59 #define UINT64_MIN  UINT64_C(0)
    60 #define UINT64_MAX  UINT64_C(0xFFFFFFFFFFFFFFFF)
    61 
    62 #include <libarch/stdint.h>
     38#include <_bits/stdint.h>
    6339
    6440#endif
  • uspace/lib/c/include/types/common.h

    rc8fbbe7 r810a36f  
    3636#define LIBC_TYPES_COMMON_H_
    3737
    38 #include <libarch/types.h>
     38#if __SIZEOF_POINTER__ == 4
     39#define __32_BITS__
     40#elif __SIZEOF_POINTER__ == 8
     41#define __64_BITS__
     42#else
     43#error __SIZEOF_POINTER__ is not defined.
     44#endif
     45
     46#include <_bits/all.h>
    3947
    4048#endif
  • uspace/lib/draw/gfx/font-8x16.h

    rc8fbbe7 r810a36f  
    3838#include <stdint.h>
    3939#include <stdbool.h>
     40#include <stddef.h>
    4041
    4142#define FONT_GLYPHS     2899
  • uspace/lib/drv/generic/logbuf.c

    rc8fbbe7 r810a36f  
    3131 */
    3232
    33 #include <libarch/common.h>
    3433#include <stdio.h>
    3534#include <stddef.h>
  • uspace/lib/drv/include/ddf/interrupt.h

    rc8fbbe7 r810a36f  
    3636#define DDF_INTERRUPT_H_
    3737
    38 #include <libarch/common.h>
    3938#include <types/common.h>
    4039#include <abi/ddi/irq.h>
  • uspace/lib/http/include/http/receive-buffer.h

    rc8fbbe7 r810a36f  
    3939#include <adt/list.h>
    4040#include <stddef.h>
     41#include <types/common.h>
    4142
    4243/** Receive data.
  • uspace/lib/math/include/mathtypes.h

    rc8fbbe7 r810a36f  
    191191#endif
    192192
    193 
    194 #if defined(FLOAT_SIZE_32)
    195 
    196 #ifndef float32_t
    197         #define float32_t  float
    198 #endif
    199 
    200 #elif defined(FLOAT_SIZE_64)
    201 
    202 #ifndef float64_t
    203         #define float64_t  float
    204 #endif
    205 
    206 #elif defined(FLOAT_SIZE_96)
    207 
    208 #ifndef float96_t
    209         #define float96_t  float
    210 #endif
    211 
    212 #elif defined(FLOAT_SIZE_128)
    213 
    214 #ifndef float128_t
    215         #define float128_t  float
    216 #endif
    217 
    218 #endif
    219 
    220 
    221 #if defined(DOUBLE_SIZE_32)
    222 
    223 #ifndef float32_t
    224         #define float32_t  double
    225 #endif
    226 
    227 #elif defined(DOUBLE_SIZE_64)
    228 
    229 #ifndef float64_t
    230         #define float64_t  double
    231 #endif
    232 
    233 #elif defined(DOUBLE_SIZE_96)
    234 
    235 #ifndef float96_t
    236         #define float96_t  double
    237 #endif
    238 
    239 #elif defined(DOUBLE_SIZE_128)
    240 
    241 #ifndef float128_t
    242         #define float128_t  double
    243 #endif
    244 
    245 #endif
    246 
    247 
    248 #if defined(LONG_DOUBLE_SIZE_32)
    249 
    250 #ifndef float32_t
    251         #define float32_t  long double
    252 #endif
    253 
    254 #elif defined(LONG_DOUBLE_SIZE_64)
    255 
    256 #ifndef float64_t
    257         #define float64_t  long double
    258 #endif
    259 
    260 #elif defined(LONG_DOUBLE_SIZE_96)
    261 
    262 #ifndef float96_t
    263         #define float96_t  long double
    264 #endif
    265 
    266 #elif defined(LONG_DOUBLE_SIZE_128)
    267 
    268 #ifndef float128_t
    269         #define float128_t  long double
    270 #endif
    271 
    272 #endif
    273 
     193#if __SIZEOF_FLOAT__ == 4
     194#define float32_t float
     195#elif __SIZEOF_DOUBLE__ == 4
     196#define float32_t double
     197#elif __SIZEOF_LONG_DOUBLE__ == 4
     198#define float32_t long double
     199#endif
     200
     201#if __SIZEOF_FLOAT__ == 8
     202#define float64_t float
     203#elif __SIZEOF_DOUBLE__ == 8
     204#define float64_t double
     205#elif __SIZEOF_LONG_DOUBLE__ == 8
     206#define float64_t long double
     207#endif
     208
     209#if __SIZEOF_FLOAT__ == 12
     210#define float96_t float
     211#elif __SIZEOF_DOUBLE__ == 12
     212#define float96_t double
     213#elif __SIZEOF_LONG_DOUBLE__ == 12
     214#define float96_t long double
     215#endif
     216
     217#if __SIZEOF_FLOAT__ == 16
     218#define float128_t float
     219#elif __SIZEOF_DOUBLE__ == 16
     220#define float128_t double
     221#elif __SIZEOF_LONG_DOUBLE__ == 16
     222#define float128_t long double
     223#endif
    274224
    275225#ifdef float32_t
  • uspace/lib/nic/include/nic_addr_db.h

    rc8fbbe7 r810a36f  
    4444
    4545#include <adt/hash_table.h>
     46#include <types/common.h>
    4647
    4748/**
  • uspace/lib/nic/src/nic_addr_db.c

    rc8fbbe7 r810a36f  
    3636 */
    3737#include "nic_addr_db.h"
    38 #include "libarch/common.h"
    3938#include <assert.h>
    4039#include <stdlib.h>
  • uspace/lib/posix/include/posix/limits.h

    rc8fbbe7 r810a36f  
    4242#define PATH_MAX 256
    4343
    44 /* it's probably a safe assumption */
    45 #undef CHAR_BIT
    46 #define CHAR_BIT 8
    47 
    4844#endif /* POSIX_LIMITS_H_ */
    4945
  • uspace/lib/posix/include/posix/locale.h

    rc8fbbe7 r810a36f  
    4040#endif
    4141
    42 #ifndef NULL
    43         #define NULL ((void *) 0)
    44 #endif
     42#include <_bits/NULL.h>
    4543
    4644#ifndef __locale_t_defined
  • uspace/lib/posix/include/posix/stddef.h

    rc8fbbe7 r810a36f  
    4242#include "sys/types.h"
    4343
    44 #ifndef NULL
    45         #define NULL  ((void *) 0)
    46 #endif
     44#include <_bits/NULL.h>
    4745
    4846#define offsetof(type,member) ((size_t) &(((type *) 0)->member))
  • uspace/lib/posix/include/posix/stdint.h

    rc8fbbe7 r810a36f  
    4242#include "libc/stdint.h"
    4343
    44 #undef INT8_MAX
    45 #undef INT8_MIN
    46 #define INT8_MAX  127
    47 #define INT8_MIN  (-128)
    48 
    49 #undef UINT8_MAX
    50 #undef UINT8_MIN
    51 #define UINT8_MAX  255
    52 #define UINT8_MIN  0
    53 
    54 #undef INT16_MAX
    55 #undef INT16_MIN
    56 #define INT16_MAX  32767
    57 #define INT16_MIN  (-32768)
    58 
    59 #undef UINT16_MAX
    60 #undef UINT16_MIN
    61 #define UINT16_MAX  65535
    62 #define UINT16_MIN  0
    63 
    64 #undef INT32_MAX
    65 #undef INT32_MIN
    66 #define INT32_MAX  2147483647
    67 #define INT32_MIN  (-INT32_MAX - 1)
    68 
    69 #undef UINT32_MAX
    70 #undef UINT32_MIN
    71 #define UINT32_MAX  4294967295U
    72 #define UINT32_MIN  0U
    73 
    74 #undef INT64_MAX
    75 #undef INT64_MIN
    76 #define INT64_MAX  9223372036854775807LL
    77 #define INT64_MIN  (-INT64_MAX - 1LL)
    78 
    79 #undef UINT64_MAX
    80 #undef  UINT64_MIN
    81 #define UINT64_MAX  18446744073709551615ULL
    82 #define UINT64_MIN  0ULL
    83 
    8444#undef OFF64_MAX
    8545#undef OFF64_MIN
     
    9252#define AOFF64_MIN  UINT64_MIN
    9353
    94 #undef INTMAX_MIN
    95 #undef INTMAX_MAX
    96 #define INTMAX_MIN INT64_MIN
    97 #define INTMAX_MAX INT64_MAX
    98 
    99 #undef UINTMAX_MIN
    100 #undef UINTMAX_MAX
    101 #define UINTMAX_MIN UINT64_MIN
    102 #define UINTMAX_MAX UINT64_MAX
    103 
    104 /*
    105  * Fast* and least* integer types.
    106  *
    107  * The definitions below are correct as long as uint8/16/32/64_t are defined.
    108  * Considering the entire rest of the system would break down if they were not,
    109  * these definitions are just fine.
    110  */
    111 typedef uint8_t uint_least8_t;
    112 typedef uint16_t uint_least16_t;
    113 typedef uint32_t uint_least32_t;
    114 typedef uint64_t uint_least64_t;
    115 
    116 typedef int8_t int_least8_t;
    117 typedef int16_t int_least16_t;
    118 typedef int32_t int_least32_t;
    119 typedef int64_t int_least64_t;
    120 
    121 typedef uint8_t uint_fast8_t;
    122 typedef uint16_t uint_fast16_t;
    123 typedef uint32_t uint_fast32_t;
    124 typedef uint64_t uint_fast64_t;
    125 
    126 typedef int8_t int_fast8_t;
    127 typedef int16_t int_fast16_t;
    128 typedef int32_t int_fast32_t;
    129 typedef int64_t int_fast64_t;
    130 
    13154#endif /* POSIX_STDINT_H_ */
    13255
  • uspace/lib/posix/include/posix/stdlib.h

    rc8fbbe7 r810a36f  
    4343#include "sys/types.h"
    4444
    45 #ifndef NULL
    46         #define NULL  ((void *) 0)
    47 #endif
     45#include <_bits/NULL.h>
    4846
    4947#define RAND_MAX  714025
  • uspace/lib/posix/include/posix/string.h

    rc8fbbe7 r810a36f  
    5151 */
    5252
    53 #ifndef NULL
    54         #define NULL  ((void *) 0)
    55 #endif
     53#include <_bits/NULL.h>
    5654
    5755/*
  • uspace/lib/posix/include/posix/time.h

    rc8fbbe7 r810a36f  
    4343#include "sys/types.h"
    4444
    45 #ifndef NULL
    46         #define NULL  ((void *) 0)
    47 #endif
     45#include <_bits/NULL.h>
    4846
    4947#ifndef CLOCKS_PER_SEC
  • uspace/lib/trackmod/xm.c

    rc8fbbe7 r810a36f  
    3838#include <stdlib.h>
    3939#include <mem.h>
     40#include <types/common.h>
    4041
    4142#include "byteorder.h"
Note: See TracChangeset for help on using the changeset viewer.