summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-04-02 14:43:47 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-04-02 14:43:47 (GMT)
commitf9404bf68a067b06986cd85855c43795ec578dbd (patch)
tree57f481aced2c69ddf6ac9766f310be86ebe03f6f /tools
parentd69503d7aeceddc52dfee9481e6a0e8ba9c1fc85 (diff)
Removed lots of uninitialized uses, mostly in NDEBUG mode.
Diffstat (limited to 'tools')
-rw-r--r--tools/d2c/encoding.c37
-rw-r--r--tools/d2c/syntax.c6
2 files changed, 18 insertions, 25 deletions
diff --git a/tools/d2c/encoding.c b/tools/d2c/encoding.c
index 052fc04..3f0ec64 100644
--- a/tools/d2c/encoding.c
+++ b/tools/d2c/encoding.c
@@ -325,37 +325,13 @@ bool write_encoding_spec_raw_disass(const encoding_spec *spec, int fd, const cha
bool openbar; /* Syntaxe unique par défaut ? */
disass_assert *dassert; /* Eventuelles conditions */
size_t i; /* Boucle de parcours */
-
-
-
-
-
-
bool op_decl; /* Suivi des déclaration #1 */
bool imm_decl; /* Suivi des déclaration #2 */
-
bool bad_exit; /* Ajout d'une sortie d'échec ?*/
bool quick_exit; /* Inclusion de sortie rapide ?*/
-
-
-
char *encoding_fc; /* Spécification d'encodage */
char *cast; /* Conversion vers le format */
-
-
- /***************
- *
- *
- * REAL ONE
- *
- *
- *
- **********************/
-
-
-
-
result = true;
/* Détermination de la forme du code */
@@ -418,6 +394,14 @@ bool write_encoding_spec_raw_disass(const encoding_spec *spec, int fd, const cha
dprintf(fd, "\n");
+ /* Initialisation du resultat d'un point de vue global */
+
+ if (!openbar)
+ {
+ dprintf(fd, "\tresult = NULL;\n");
+ dprintf(fd, "\n");
+ }
+
/* Définition des champs bruts */
result = define_used_bits_fields(spec->bits, fd);
@@ -435,7 +419,10 @@ bool write_encoding_spec_raw_disass(const encoding_spec *spec, int fd, const cha
cast = build_cast_if_needed(encoding_fc);
- dprintf(fd, "\t%s(%s(result), \"%s\");\n", encoding_fc, cast, spec->prefix);
+ if (!openbar)
+ dprintf(fd, "\tif (result != NULL)\n");
+
+ dprintf(fd, "\t%s%s(%s(result), \"%s\");\n", openbar ? "" : "\t", encoding_fc, cast, spec->prefix);
free(cast);
diff --git a/tools/d2c/syntax.c b/tools/d2c/syntax.c
index c0842a7..de1d693 100644
--- a/tools/d2c/syntax.c
+++ b/tools/d2c/syntax.c
@@ -284,6 +284,12 @@ bool write_encoding_syntax(const encoding_syntax *syntax, int fd, const char *ar
}
+ if (!alone)
+ {
+ dprintf(fd, "\t%sassert(result == NULL);\n", tab);
+ dprintf(fd, "\n");
+ }
+
dprintf(fd, "\t%sresult = g_%s_instruction_new(\"%s\");\n",
tab, arch, get_keyword_from_asm_pattern(syntax->pattern));