1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ 2 /* 3 * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana 4 * University Research and Technology 5 * Corporation. All rights reserved. 6 * Copyright (c) 2004-2005 The University of Tennessee and The University 7 * of Tennessee Research Foundation. All rights 8 * reserved. 9 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, 10 * University of Stuttgart. All rights reserved. 11 * Copyright (c) 2004-2005 The Regents of the University of California. 12 * All rights reserved. 13 * Copyright (c) 2015 Los Alamos National Security, LLC. All rights 14 * reserved. 15 * Copyright (c) 2016 Research Organization for Information Science 16 * and Technology (RIST). All rights reserved. 17 * Copyright (c) 2018 Intel, Inc. All rights reserved. 18 * $COPYRIGHT$ 19 * 20 * Additional copyrights may follow 21 * 22 * $HEADER$ 23 * 24 * This file includes the C99 stdint.h file if available, and otherwise 25 * defines fixed-width types according to the SIZEOF information 26 * gathered by configure. 27 */ 28 29 #ifndef PMIX_STDINT_H 30 #define PMIX_STDINT_H 1 31 32 #include "pmix_config.h" 33 34 /* 35 * Include what we can and define what is missing. 36 */ 37 #include <limits.h> 38 #include <stdint.h> 39 40 #ifdef HAVE_SYS_TYPES_H 41 #include <sys/types.h> 42 #endif 43 44 /* 128-bit */ 45 46 #ifdef HAVE_INT128_T 47 48 typedef int128_t pmix_int128_t; 49 typedef uint128_t pmix_uint128_t; 50 51 #define HAVE_PMIX_INT128_T 1 52 53 #elif defined(HAVE___INT128) 54 55 /* suppress warning about __int128 type */ 56 #pragma GCC diagnostic push 57 /* Clang won't quietly accept "-pedantic", but GCC versions older than ~4.8 58 * won't quietly accept "-Wpedanic". The whole "#pragma GCC diagnostic ..." 59 * facility only was added to GCC as of version 4.6. */ 60 #if defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 6) 61 #pragma GCC diagnostic ignored "-Wpedantic" 62 #else 63 #pragma GCC diagnostic ignored "-pedantic" 64 #endif 65 typedef __int128 pmix_int128_t; 66 typedef unsigned __int128 pmix_uint128_t; 67 #pragma GCC diagnostic pop 68 69 #define HAVE_PMIX_INT128_T 1 70 71 #else 72 73 #define HAVE_PMIX_INT128_T 0 74 75 #endif 76 77 /* Pointers */ 78 79 #if SIZEOF_VOID_P == SIZEOF_INT 80 81 #ifndef HAVE_INTPTR_T 82 typedef signed int intptr_t; 83 #endif 84 85 #ifndef HAVE_UINTPTR_T 86 typedef unsigned int uintptr_t; 87 #endif 88 89 #elif SIZEOF_VOID_P == SIZEOF_LONG 90 91 #ifndef HAVE_INTPTR_T 92 typedef signed long intptr_t; 93 #endif 94 95 #ifndef HAVE_UINTPTR_T 96 typedef unsigned long uintptr_t; 97 #endif 98 99 #elif HAVE_LONG_LONG && SIZEOF_VOID_P == SIZEOF_LONG_LONG 100 101 #ifndef HAVE_INTPTR_T 102 typedef signed long long intptr_t; 103 #endif 104 #ifndef HAVE_UINTPTR_T 105 typedef unsigned long long uintptr_t; 106 #endif 107 108 #else 109 110 #error Failed to define pointer-sized integer types 111 112 #endif 113 114 /* inttypes.h printf specifiers */ 115 # include <inttypes.h> 116 117 #ifndef PRIsize_t 118 # if defined(ACCEPT_C99) 119 # define PRIsize_t "zu" 120 # elif SIZEOF_SIZE_T == SIZEOF_LONG 121 # define PRIsize_t "lu" 122 # elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG 123 # define PRIsize_t "llu" 124 # else 125 # define PRIsize_t "u" 126 # endif 127 #endif 128 129 #endif /* PMIX_STDINT_H */ 130 131