Behavior of -fnative-types made default; old behavior saved under -fwide-types
diff --git a/libasn1compiler/asn1c_constraint.c b/libasn1compiler/asn1c_constraint.c
index e9d796d..c957623 100644
--- a/libasn1compiler/asn1c_constraint.c
+++ b/libasn1compiler/asn1c_constraint.c
@@ -78,7 +78,7 @@
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 @@
}
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 @@
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 dcda8a9..0ccd336 100644
--- a/libasn1compiler/asn1c_misc.c
+++ b/libasn1compiler/asn1c_misc.c
@@ -16,7 +16,7 @@
"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 @@
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 @@
}
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 @@
|| 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 @@
&& (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 6e2acb5..4cb26ac 100644
--- a/libasn1compiler/asn1c_misc.h
+++ b/libasn1compiler/asn1c_misc.h
@@ -32,13 +32,13 @@
* 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 93755da..a19f147 100644
--- a/libasn1compiler/asn1compiler.h
+++ b/libasn1compiler/asn1compiler.h
@@ -20,9 +20,9 @@
*/
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.
*/