зеркало из https://github.com/mozilla/gecko-dev.git
Bug 849667 - Fix/simplify CheckedInt's use-outside-of-MFBT setup - r=Waldo
This commit is contained in:
Родитель
253e165457
Коммит
cbd3607515
|
@ -8,33 +8,20 @@
|
|||
#ifndef mozilla_CheckedInt_h_
|
||||
#define mozilla_CheckedInt_h_
|
||||
|
||||
/*
|
||||
* Build options. Comment out these #defines to disable the corresponding
|
||||
* optional feature. Disabling features may be useful for code using
|
||||
* CheckedInt outside of Mozilla (e.g. WebKit)
|
||||
*/
|
||||
// Enable relying of Mozilla's MFBT for possibly-available C++11 features
|
||||
#define MOZ_CHECKEDINT_USE_MFBT
|
||||
|
||||
// Enable usage of MOZ_STATIC_ASSERT to check for unsupported types.
|
||||
// If disabled, static asserts are replaced by regular assert().
|
||||
#define MOZ_CHECKEDINT_ENABLE_MOZ_ASSERTS
|
||||
|
||||
/*
|
||||
* End of build options
|
||||
*/
|
||||
|
||||
|
||||
#ifdef MOZ_CHECKEDINT_ENABLE_MOZ_ASSERTS
|
||||
#ifdef MOZ_CHECKEDINT_USE_MFBT
|
||||
# include "mozilla/Assertions.h"
|
||||
# include "mozilla/StandardInteger.h"
|
||||
#else
|
||||
# ifndef MOZ_STATIC_ASSERT
|
||||
# include <cassert>
|
||||
# define MOZ_STATIC_ASSERT(cond, reason) assert((cond) && reason)
|
||||
# define MOZ_ASSERT(cond, reason) assert((cond) && reason)
|
||||
# endif
|
||||
# include <cassert>
|
||||
# include <stdint.h>
|
||||
# define MOZ_STATIC_ASSERT(cond, reason) assert((cond) && reason)
|
||||
# define MOZ_ASSERT(cond, reason) assert((cond) && reason)
|
||||
# define MOZ_DELETE
|
||||
#endif
|
||||
|
||||
#include "mozilla/StandardInteger.h"
|
||||
|
||||
#include <climits>
|
||||
#include <cstddef>
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
#include <iostream>
|
||||
#include <climits>
|
||||
|
||||
#ifndef MOZ_CHECKEDINT_ENABLE_MOZ_ASSERTS
|
||||
# error MOZ_CHECKEDINT_ENABLE_MOZ_ASSERTS should be defined by CheckedInt.h
|
||||
#ifndef MOZ_CHECKEDINT_USE_MFBT
|
||||
# error "MOZ_CHECKEDINT_USE_MFBT should be defined by CheckedInt.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
|
|
Загрузка…
Ссылка в новой задаче