Replace #warning with the standard #error.

This commit is contained in:
Petteri Aimonen
2012-07-05 18:19:38 +03:00
parent 7c5bb6541a
commit 72cca8d783
2 changed files with 3 additions and 7 deletions

View File

@@ -420,8 +420,8 @@ def generate_header(dependencies, headername, enums, messages):
if largest_count > 64: if largest_count > 64:
yield '\n/* Check that missing required fields will be properly detected */\n' yield '\n/* Check that missing required fields will be properly detected */\n'
yield '#if PB_MAX_REQUIRED_FIELDS < %d\n' % largest_count yield '#if PB_MAX_REQUIRED_FIELDS < %d\n' % largest_count
yield '#warning Properly detecting missing required fields in %s requires \\\n' % largest_msg.name yield '#error Properly detecting missing required fields in %s requires \\\n' % largest_msg.name
yield ' setting PB_MAX_REQUIRED_FIELDS to %d or more.\n' % largest_count yield ' setting PB_MAX_REQUIRED_FIELDS to %d or more.\n' % largest_count
yield '#endif\n' yield '#endif\n'
worst = 0 worst = 0
@@ -438,9 +438,6 @@ def generate_header(dependencies, headername, enums, messages):
if worst > 255 or checks: if worst > 255 or checks:
yield '\n/* Check that field information fits in pb_field_t */\n' yield '\n/* Check that field information fits in pb_field_t */\n'
yield '/* (Largest message has %d fields' % worst
if checks: yield ' and submessages have to be checked at compile-time.'
yield ') */\n'
if worst < 65536: if worst < 65536:
yield '#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)\n' yield '#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)\n'

3
pb.h
View File

@@ -34,8 +34,7 @@
#endif #endif
#if PB_MAX_REQUIRED_FIELDS < 64 #if PB_MAX_REQUIRED_FIELDS < 64
#warning You should not lower PB_MAX_REQUIRED_FIELDS from the default value (64). \ #error You should not lower PB_MAX_REQUIRED_FIELDS from the default value (64).
The automatic checks against too low value will not be active.
#endif #endif
/* List of possible field types. These are used in the autogenerated code. /* List of possible field types. These are used in the autogenerated code.