/ src / google_breakpad / common / breakpad_types.h
breakpad_types.h
 1  /* Copyright 2006 Google LLC
 2   *
 3   * Redistribution and use in source and binary forms, with or without
 4   * modification, are permitted provided that the following conditions are
 5   * met:
 6   *
 7   *     * Redistributions of source code must retain the above copyright
 8   * notice, this list of conditions and the following disclaimer.
 9   *     * Redistributions in binary form must reproduce the above
10   * copyright notice, this list of conditions and the following disclaimer
11   * in the documentation and/or other materials provided with the
12   * distribution.
13   *     * Neither the name of Google LLC nor the names of its
14   * contributors may be used to endorse or promote products derived from
15   * this software without specific prior written permission.
16   *
17   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20   * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21   * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24   * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25   * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28  
29  /* breakpad_types.h: Precise-width types
30   *
31   * (This is C99 source, please don't corrupt it with C++.)
32   *
33   * This file ensures that types uintN_t are defined for N = 8, 16, 32, and
34   * 64.  Types of precise widths are crucial to the task of writing data
35   * structures on one platform and reading them on another.
36   *
37   * Author: Mark Mentovai */
38  
39  #ifndef GOOGLE_BREAKPAD_COMMON_BREAKPAD_TYPES_H__
40  #define GOOGLE_BREAKPAD_COMMON_BREAKPAD_TYPES_H__
41  
42  #if (defined(_INTTYPES_H) || defined(_INTTYPES_H_)) && \
43      !defined(__STDC_FORMAT_MACROS)
44  #error "inttypes.h has already been included before this header file, but "
45  #error "without __STDC_FORMAT_MACROS defined."
46  #endif
47  
48  #ifndef __STDC_FORMAT_MACROS
49  #define __STDC_FORMAT_MACROS
50  #endif  /* __STDC_FORMAT_MACROS */
51  #include <inttypes.h>
52  
53  typedef struct {
54    uint64_t high;
55    uint64_t low;
56  } uint128_struct;
57  
58  typedef uint64_t breakpad_time_t;
59  
60  /* Try to get PRIx64 from inttypes.h, but if it's not defined, fall back to
61   * llx, which is the format string for "long long" - this is a 64-bit
62   * integral type on many systems. */
63  #ifndef PRIx64
64  #define PRIx64 "llx"
65  #endif  /* !PRIx64 */
66  
67  #endif  /* GOOGLE_BREAKPAD_COMMON_BREAKPAD_TYPES_H__ */