| David 'Digit' Turner | d3f2c27 | 2014-02-19 22:39:08 +0100 | [diff] [blame^] | 1 | // Copyright 2014 The Android Open Source Project |
| 2 | // |
| 3 | // This software is licensed under the terms of the GNU General Public |
| 4 | // License version 2, as published by the Free Software Foundation, and |
| 5 | // may be copied, distributed, and modified under those terms. |
| 6 | // |
| 7 | // This program is distributed in the hope that it will be useful, |
| 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | // GNU General Public License for more details. |
| 11 | |
| 12 | #ifndef ANDROID_BASE_LIMITS_H |
| 13 | #define ANDROID_BASE_LIMITS_H |
| 14 | |
| 15 | // In C++, <stdint.h> will only define macros like SIZE_MAX if you have |
| 16 | // defined __STDC_LIMIT_MACROS before including <stdint.h>. This header |
| 17 | // is used to do just that and verify that the macros are properly |
| 18 | // defined. |
| 19 | // |
| 20 | // NOTE: We have to define __STDC_FORMAT_MACROS in case the user wants |
| 21 | // to use the corresponding macros as well. |
| 22 | |
| 23 | #define __STDC_LIMIT_MACROS 1 |
| 24 | #define __STDC_FORMAT_MACROS 1 |
| 25 | #include <inttypes.h> |
| 26 | |
| 27 | #ifndef SIZE_MAX |
| 28 | #warning "<inttypes.h> has been included before this header." |
| 29 | #warning "This prevents the definition of useful macros." |
| 30 | #error "Please include <android/base/Limits.h> first!" |
| 31 | #endif |
| 32 | |
| 33 | #endif // ANDROID_BASE_LIMITS_H |