Commit 2e8ee8d5 authored by Lev Walkin's avatar Lev Walkin Committed by GitHub

Merge pull request #96 from brchiu/fix_declaration_inside_parameter_list_warning

Fix 'declaration inside parameter list' warning
parents 4aa1e96d 9b87e5b0
This diff is collapsed.
......@@ -38,6 +38,11 @@ asn1c_compiled_output(arg_t *arg, const char *fmt, ...) {
*/
if(dst->indented == 0) {
int i = dst->indent_level;
if (i < 0) {
/* fatal error */
fprintf(stderr, "target %d : Indent level %d ?!\n", arg->target->target, i);
exit(1);
}
dst->indented = 1;
while(i--) {
ret = asn1c_compiled_output(arg, "\t");
......
......@@ -17,6 +17,7 @@ typedef struct compiler_streams {
OT_INCLUDES, /* #include files */
OT_DEPS, /* Dependencies (other than #includes) */
OT_FWD_DECLS, /* Forward declarations */
OT_FWD_DEFS, /* Forward definitions */
OT_TYPE_DECLS, /* Type declarations */
OT_FUNC_DECLS, /* Function declarations */
OT_POST_INCLUDE,/* #include after type definition */
......@@ -35,7 +36,7 @@ typedef struct compiler_streams {
} compiler_streams_t;
static char *_compiler_stream2str[] __attribute__ ((unused))
= { "IGNORE", "INCLUDES", "DEPS", "FWD-DECLS", "TYPE-DECLS", "FUNC-DECLS", "POST-INCLUDE", "CTABLES", "CODE", "CTDEFS", "STAT-DEFS" };
= { "IGNORE", "INCLUDES", "DEPS", "FWD-DECLS", "FWD-DEFS", "TYPE-DECLS", "FUNC-DECLS", "POST-INCLUDE", "CTABLES", "CODE", "CTDEFS", "STAT-DEFS" };
int asn1c_compiled_output(arg_t *arg, const char *fmt, ...);
......@@ -56,8 +57,6 @@ int asn1c_compiled_output(arg_t *arg, const char *fmt, ...);
} while(0)
#define EMBED(ev) do { \
int saved_target = arg->target->target; \
REDIR(OT_TYPE_DECLS); \
arg->embed++; \
INDENTED(arg_t _tmp = *arg; \
_tmp.expr = ev; \
......@@ -66,8 +65,8 @@ int asn1c_compiled_output(arg_t *arg, const char *fmt, ...);
arg->embed--; \
if(ev->expr_type != A1TC_EXTENSIBLE) \
OUT(";\n"); \
assert(arg->target->target == OT_TYPE_DECLS); \
REDIR(saved_target); \
assert(arg->target->target == OT_TYPE_DECLS || \
arg->target->target == OT_FWD_DEFS); \
} while(0)
/* Output a piece of text into a default stream */
......
......@@ -283,6 +283,7 @@ asn1c_save_streams(arg_t *arg, asn1c_fdeps_t *deps, int optc, char **argv) {
safe_fprintf(fp_h, "\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n");
SAVE_STREAM(fp_h, OT_DEPS, "Dependencies", 0);
SAVE_STREAM(fp_h, OT_FWD_DECLS, "Forward declarations", 0);
SAVE_STREAM(fp_h, OT_FWD_DEFS, "Forward definitions", 0);
SAVE_STREAM(fp_h, OT_TYPE_DECLS, expr->Identifier, 0);
SAVE_STREAM(fp_h, OT_FUNC_DECLS,"Implementation", 0);
safe_fprintf(fp_h, "\n#ifdef __cplusplus\n}\n#endif\n");
......@@ -305,7 +306,7 @@ asn1c_save_streams(arg_t *arg, asn1c_fdeps_t *deps, int optc, char **argv) {
TQ_FOR(ot, &(cs->destination[OT_STAT_DEFS].chunks), next)
safe_fwrite(ot->buf, ot->len, 1, fp_c);
assert(OT_MAX == 11); /* Protection from reckless changes */
assert(OT_MAX == 12); /* Protection from reckless changes */
fclose(fp_c);
fclose(fp_h);
......
......@@ -184,6 +184,19 @@ typedef enum other_PR {
struct Forest;
/*** <<< FWD-DEFS [Stuff] >>> ***/
typedef struct Member {
BIT_STRING_t cup_of_coffee;
/*
* This type is extensible,
* possible extensions are below.
*/
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} Member;
/*** <<< TYPE-DECLS [Stuff] >>> ***/
typedef struct Stuff {
......@@ -194,16 +207,7 @@ typedef struct Stuff {
asn_struct_ctx_t _asn_ctx;
} *trees;
struct anything {
A_SET_OF(struct Member {
BIT_STRING_t cup_of_coffee;
/*
* This type is extensible,
* possible extensions are below.
*/
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} ) list;
A_SET_OF(Member) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
......
......@@ -7,16 +7,20 @@
#include <constr_SEQUENCE.h>
#include <constr_SET_OF.h>
/*** <<< FWD-DEFS [Type] >>> ***/
typedef struct Member {
Type1_t t1;
Type2_t t2;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} Member;
/*** <<< TYPE-DECLS [Type] >>> ***/
typedef struct Type {
A_SET_OF(struct Member {
Type1_t t1;
Type2_t t2;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} ) list;
A_SET_OF(Member) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
......
......@@ -623,23 +623,27 @@ asn_TYPE_descriptor_t asn_DEF_Choice3 = {
struct Set;
struct Sequence;
/*** <<< FWD-DEFS [Set] >>> ***/
typedef struct Member {
long Int;
struct Set *set;
struct Sequence *seq;
struct Set *set2 /* OPTIONAL */;
/*
* This type is extensible,
* possible extensions are below.
*/
struct Set *set3;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} Member;
/*** <<< TYPE-DECLS [Set] >>> ***/
typedef struct Set {
A_SET_OF(struct Member {
long Int;
struct Set *set;
struct Sequence *seq;
struct Set *set2 /* OPTIONAL */;
/*
* This type is extensible,
* possible extensions are below.
*/
struct Set *set3;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} ) list;
A_SET_OF(Member) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
......
......@@ -622,23 +622,27 @@ asn_TYPE_descriptor_t asn_DEF_Choice3 = {
struct Set;
struct Sequence;
/*** <<< FWD-DEFS [Set] >>> ***/
typedef struct Member {
INTEGER_t Int;
struct Set *set;
struct Sequence *seq;
struct Set *set2 /* OPTIONAL */;
/*
* This type is extensible,
* possible extensions are below.
*/
struct Set *set3;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} Member;
/*** <<< TYPE-DECLS [Set] >>> ***/
typedef struct Set {
A_SET_OF(struct Member {
INTEGER_t Int;
struct Set *set;
struct Sequence *seq;
struct Set *set2 /* OPTIONAL */;
/*
* This type is extensible,
* possible extensions are below.
*/
struct Set *set3;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} ) list;
A_SET_OF(Member) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment