aboutsummaryrefslogtreecommitdiffstats
path: root/libasn1compiler
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2013-03-27 01:56:23 -0700
committerLev Walkin <vlm@lionet.info>2013-03-27 01:56:23 -0700
commit2a744a747082995dec6f524368807391e0baa569 (patch)
treeb472e9f10a52e5e638945a827541c4f2c4412e2b /libasn1compiler
parent11c9a8c7edfc1dbff68c1630bf00f4eb9de24e04 (diff)
Behavior of -fnative-types made default; old behavior saved under -fwide-types
Diffstat (limited to 'libasn1compiler')
-rw-r--r--libasn1compiler/asn1c_constraint.c8
-rw-r--r--libasn1compiler/asn1c_misc.c18
-rw-r--r--libasn1compiler/asn1c_misc.h4
-rw-r--r--libasn1compiler/asn1compiler.h4
4 files changed, 17 insertions, 17 deletions
diff --git a/libasn1compiler/asn1c_constraint.c b/libasn1compiler/asn1c_constraint.c
index e9d796de..c957623e 100644
--- a/libasn1compiler/asn1c_constraint.c
+++ b/libasn1compiler/asn1c_constraint.c
@@ -78,7 +78,7 @@ asn1c_emit_constraint_checking_code(arg_t *arg) {
produce_st = 1;
break;
case ASN_BASIC_REAL:
- if(!(arg->flags & A1C_USE_NATIVE_TYPES))
+ if((arg->flags & A1C_USE_WIDE_TYPES))
produce_st = 1;
break;
case ASN_BASIC_BIT_STRING:
@@ -656,9 +656,7 @@ emit_value_determination_code(arg_t *arg, asn1p_expr_type_e etype, asn1cnst_rang
}
break;
case ASN_BASIC_REAL:
- if(arg->flags & A1C_USE_NATIVE_TYPES) {
- OUT("value = *(const double *)sptr;\n");
- } else {
+ if(arg->flags & A1C_USE_WIDE_TYPES) {
OUT("if(asn_REAL2double(st, &value)) {\n");
INDENT(+1);
OUT("_ASN_CTFAIL(app_key, td, sptr,\n");
@@ -667,6 +665,8 @@ emit_value_determination_code(arg_t *arg, asn1p_expr_type_e etype, asn1cnst_rang
OUT("return -1;\n");
INDENT(-1);
OUT("}\n");
+ } else {
+ OUT("value = *(const double *)sptr;\n");
}
break;
case ASN_BASIC_BOOLEAN:
diff --git a/libasn1compiler/asn1c_misc.c b/libasn1compiler/asn1c_misc.c
index dcda8a91..0ccd3362 100644
--- a/libasn1compiler/asn1c_misc.c
+++ b/libasn1compiler/asn1c_misc.c
@@ -16,7 +16,7 @@ static char *res_kwd[] = {
"union", "unsigned", "void", "volatile", "while",
"_Bool", "_Complex", "_Imaginary",
/* C++ */
- "explicit", "bool", "mutable",
+ "class", "explicit", "bool", "mutable",
"template", "typeid", "typename", "and", "and_eq",
"or", "or_eq", "xor", "xor_eq", "not", "not_eq",
"bitor", "compl", "bitand",
@@ -214,7 +214,7 @@ asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format) {
case ASN_BASIC_ENUMERATED:
case ASN_BASIC_REAL:
if((expr->expr_type == ASN_BASIC_REAL
- && (arg->flags & A1C_USE_NATIVE_TYPES))
+ && !(arg->flags & A1C_USE_WIDE_TYPES))
|| asn1c_type_fits_long(arg, expr)) {
switch(_format) {
case TNF_CTYPE:
@@ -333,8 +333,8 @@ asn1c_type_fits_long(arg_t *arg, asn1p_expr_t *expr) {
}
if(!expr->combined_constraints)
- return (arg->flags & A1C_USE_NATIVE_TYPES)
- ? FL_FORCED : FL_NOTFIT;
+ return (arg->flags & A1C_USE_WIDE_TYPES)
+ ? FL_NOTFIT : FL_PRESUMED;
/*
* Second, if -fbless-SIZE is given, the (SIZE()) constraint may be
@@ -366,8 +366,8 @@ asn1c_type_fits_long(arg_t *arg, asn1p_expr_t *expr) {
|| range->not_PER_visible
) {
asn1constraint_range_free(range);
- return (arg->flags & A1C_USE_NATIVE_TYPES)
- ? FL_FORCED : FL_NOTFIT;
+ return (arg->flags & A1C_USE_WIDE_TYPES)
+ ? FL_NOTFIT : FL_PRESUMED;
}
left = range->left;
@@ -391,10 +391,10 @@ asn1c_type_fits_long(arg_t *arg, asn1p_expr_t *expr) {
&& (right.value > RIGHTMAX || right.value < LEFTMIN))
return FL_NOTFIT;
- /* If the range is open, fits only if -fnative-types is given */
+ /* If the range is open, fits only unless -fwide-types is given */
if(left.type != ARE_VALUE || right.type != ARE_VALUE) {
- return (arg->flags & A1C_USE_NATIVE_TYPES)
- ? FL_FORCED : FL_NOTFIT;
+ return (arg->flags & A1C_USE_WIDE_TYPES)
+ ? FL_NOTFIT : FL_PRESUMED;
}
return FL_FITS_SIGNED;
diff --git a/libasn1compiler/asn1c_misc.h b/libasn1compiler/asn1c_misc.h
index 6e2acb51..4cb26acd 100644
--- a/libasn1compiler/asn1c_misc.h
+++ b/libasn1compiler/asn1c_misc.h
@@ -32,13 +32,13 @@ char *asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format);
* FL_NOTFIT: No, it cannot be represented using long.
* FL_FITS_SIGNED: It can be represented using signed long.
* FL_FITS_UNSIGN: It can be represented using unsigned long.
- * FL_FORCED: Probably can't, but -fnative-types is in force.
+ * FL_PRESUMED: Probably can't, but -fwide-types is not in effect.
*/
enum asn1c_fitslong_e {
FL_NOTFIT,
FL_FITS_SIGNED,
FL_FITS_UNSIGN,
- FL_FORCED,
+ FL_PRESUMED,
};
enum asn1c_fitslong_e asn1c_type_fits_long(arg_t *arg, asn1p_expr_t *expr);
diff --git a/libasn1compiler/asn1compiler.h b/libasn1compiler/asn1compiler.h
index 93755da9..a19f147f 100644
--- a/libasn1compiler/asn1compiler.h
+++ b/libasn1compiler/asn1compiler.h
@@ -20,9 +20,9 @@ enum asn1c_flags {
*/
A1C_OMIT_SUPPORT_CODE = 0x0004,
/*
- * Use native data types instead of INTEGER_t et al.
+ * Use wide types by default (INTEGER_t etc) instead of native/long.
*/
- A1C_USE_NATIVE_TYPES = 0x0008,
+ A1C_USE_WIDE_TYPES = 0x0008,
/*
* Do not use C99 extensions.
*/