Skip to content

Commit

Permalink
Make static_assert macro agree with standard signature.
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Oct 22, 2013
1 parent 9c77501 commit d263fdf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
11 changes: 7 additions & 4 deletions libefont/cff.cc
Expand Up @@ -28,7 +28,7 @@
#include <efont/t1unparser.hh>

#ifndef static_assert
#define static_assert(c) switch (c) case 0: case (c):
#define static_assert(c, msg) switch (c) case 0: case (c):
#endif

namespace Efont {
Expand Down Expand Up @@ -346,9 +346,12 @@ Cff::Cff(const String &s, ErrorHandler *errh)
: _data_string(s), _data(reinterpret_cast<const uint8_t *>(_data_string.data())), _len(_data_string.length()),
_strings_map(-2)
{
static_assert((sizeof(standard_strings) / sizeof(standard_strings[0])) == NSTANDARD_STRINGS);
static_assert((sizeof(standard_encoding) / sizeof(standard_encoding[0])) == 256);
static_assert((sizeof(expert_encoding) / sizeof(expert_encoding[0])) == 256);
static_assert((sizeof(standard_strings) / sizeof(standard_strings[0])) == NSTANDARD_STRINGS,
"NSTANDARD_STRINGS defined incorrectly");
static_assert((sizeof(standard_encoding) / sizeof(standard_encoding[0])) == 256,
"standard_encoding has wrong size");
static_assert((sizeof(expert_encoding) / sizeof(expert_encoding[0])) == 256,
"expert_encoding has wrong size");
_error = parse_header(errh ? errh : ErrorHandler::silent_handler());
}

Expand Down
4 changes: 0 additions & 4 deletions libefont/otf.cc
Expand Up @@ -26,10 +26,6 @@
#include <efont/otfdata.hh> // for ntohl()
#include <efont/otfname.hh>

#ifndef static_assert
#define static_assert(c) switch (c) case 0: case (c):
#endif

namespace Efont { namespace OpenType {

Vector<PermString> debug_glyph_names;
Expand Down
5 changes: 3 additions & 2 deletions libefont/t1interp.cc
Expand Up @@ -31,7 +31,7 @@
#define CHECK_PATH_END() do { if (_state == S_PATH) { act_closepath(cmd); } _state = S_IPATH; } while (0)

#ifndef static_assert
# define static_assert(c) switch (c) case 0: case (c):
# define static_assert(c, msg) switch (c) case 0: case (c):
#endif

namespace Efont {
Expand Down Expand Up @@ -111,7 +111,8 @@ CharstringInterp::error(int err, int error_data)
String
CharstringInterp::error_string(int error, int error_data)
{
static_assert(-errLastError == (sizeof(error_formats) / sizeof(error_formats[0])) - 1);
static_assert(-errLastError == (sizeof(error_formats) / sizeof(error_formats[0])) - 1,
"errLastError defined incorrectly");
if (error >= 0)
return error_formats[0];
else if (error < errLastError)
Expand Down

0 comments on commit d263fdf

Please sign in to comment.