Fix: config: check for unknown "base" values in int type object
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 14 Mar 2016 20:55:24 +0000 (16:55 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 17 Mar 2016 16:38:10 +0000 (12:38 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
README.md
barectf/config.py

index e4c9e59a09d31ad48b8e71e165611475fcaf97a6..669e0ffe338cb10b1351b07ed22e44a25bbd8f6b 100644 (file)
--- a/README.md
+++ b/README.md
@@ -665,7 +665,7 @@ A CTF integer type.
 | `size` | Integer (positive) | Size (bits) (1 to 64) | Required | N/A |
 | `align` | Integer (positive) | Alignment (bits) (power of two) | Optional | 8 if `size` property is a multiple of 8, else 1 |
 | `signed` | Boolean | Signedness | Optional | `false` (unsigned) |
-| `base` | Integer | Display radix (2, 8, 10, or 16) | Optional | 10 |
+| `base` | Integer | Display radix (`bin`, `oct`, `dec`, or `hex`) | Optional | `dec` |
 | `byte-order` | String | Byte order (`le` for little-endian, `be` for big-endian, or `native` to use the byte order defined at the trace level) | Optional | `native` |
 | `property-mappings` | Array of [property mapping objects](#property-mapping-object) | Property mappings of this integer type | Optional | N/A |
 
@@ -677,7 +677,7 @@ The `property-mappings` array property currently accepts only one element.
 class: int
 size: 12
 signed: false
-base: 8
+base: oct
 byte-order: le
 property-mappings:
   - type: clock
index 22038ebb33980fe250fe49498e62a090ca243680..e3b27af2f96c3e93369e4eab310f377a6c228f32 100644 (file)
@@ -1304,6 +1304,8 @@ class _YamlConfigParser:
                 base = 10
             elif base == 'hex':
                 base = 16
+            else:
+                raise ConfigError('unknown "base" property value: "{}" ("bin", "oct", "dec", and "hex" are accepted)'.format(base))
 
             obj.base = base
 
This page took 0.025887 seconds and 4 git commands to generate.