Repare Bugs

This commit is contained in:
2016-04-01 10:59:35 +02:00
parent 7f5e0ee0ff
commit 4220e42d15
3 changed files with 14 additions and 14 deletions

View File

@@ -46,7 +46,7 @@ n_prog *programme() {
n_l_dec *herite_var = NULL; n_l_dec *herite_var = NULL;
n_l_dec *herite_func = NULL; n_l_dec *herite_func = NULL;
n_prog *sreturn; n_prog *sreturn = NULL;
if( !est_premier( _optDecVariables_, uniteCourante ) if( !est_premier( _optDecVariables_, uniteCourante )
&& !est_premier( _listeDecFonctions_, uniteCourante ) && !est_premier( _listeDecFonctions_, uniteCourante )
@@ -207,7 +207,7 @@ n_dec * declarationFonction() {
n_l_dec *param = NULL; n_l_dec *param = NULL;
n_l_dec *variables = NULL; n_l_dec *variables = NULL;
n_instr *corps = NULL; n_instr *corps = NULL;
n_dec *sreturn; n_dec *sreturn = NULL;
if( uniteCourante == ID_FCT ) { if( uniteCourante == ID_FCT ) {
name = duplique_chaine(yytext); name = duplique_chaine(yytext);
elementConsome(); elementConsome();
@@ -371,7 +371,7 @@ n_l_instr *listeInstructions() {
n_instr *instructionSi() { n_instr *instructionSi() {
openSection( __func__ ); openSection( __func__ );
n_instr *sreturn; n_instr *sreturn = NULL;
n_exp *test = NULL; n_exp *test = NULL;
n_instr *alors = NULL; n_instr *alors = NULL;
n_instr *sinon = NULL; n_instr *sinon = NULL;
@@ -401,7 +401,7 @@ n_instr *instructionSi() {
n_instr *optSinon() { n_instr *optSinon() {
openSection( __func__ ); openSection( __func__ );
n_instr *sreturn; n_instr *sreturn = NULL;
if( uniteCourante == SINON ) { if( uniteCourante == SINON ) {
elementConsome(); elementConsome();
uniteCourante = yylex(); uniteCourante = yylex();
@@ -417,9 +417,9 @@ n_instr *optSinon() {
n_instr *instructionTantque() { n_instr *instructionTantque() {
openSection( __func__ ); openSection( __func__ );
n_instr *sreturn; n_instr *sreturn = NULL;
n_exp *test; n_exp *test = NULL;
n_instr *faire; n_instr *faire = NULL;
if( uniteCourante == TANTQUE ) { if( uniteCourante == TANTQUE ) {
elementConsome(); elementConsome();
@@ -446,8 +446,8 @@ n_instr *instructionTantque() {
n_instr *instructionAppel() { n_instr *instructionAppel() {
openSection( __func__ ); openSection( __func__ );
n_instr *sreturn; n_instr *sreturn = NULL;
n_appel *app; n_appel *app = NULL;
if( est_premier( _instructionAppel_, uniteCourante ) ) { if( est_premier( _instructionAppel_, uniteCourante ) ) {
app = appelFct(); app = appelFct();
@@ -468,8 +468,8 @@ n_instr *instructionAppel() {
n_instr *instructionRetour() { n_instr *instructionRetour() {
openSection( __func__ ); openSection( __func__ );
n_instr *sreturn; n_instr *sreturn = NULL;
n_exp *expr; n_exp *expr = NULL;
if( uniteCourante == RETOUR ) { if( uniteCourante == RETOUR ) {
elementConsome(); elementConsome();
@@ -623,7 +623,7 @@ n_exp *expressionBis(n_exp *herite) {
} }
n_exp *conjonction() { n_exp *conjonction() {
n_exp *sreturn; n_exp *sreturn = NULL;
n_exp *herite_neg = NULL; n_exp *herite_neg = NULL;
openSection( __func__ ); openSection( __func__ );

View File

@@ -133,7 +133,7 @@ void parcours_instr_si(n_instr *n)
sprintf(tmp,"%s:",faux); sprintf(tmp,"%s:",faux);
printMips(tmp); printMips(tmp);
if(n->u.si_.sinon){ if(n->u.si_.sinon) {
parcours_instr(n->u.si_.sinon); parcours_instr(n->u.si_.sinon);
} }

View File

@@ -28,7 +28,7 @@ void erreur_1s(char *message, char *s) {
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
char *duplique_chaine(char *src) { char *duplique_chaine(char *src) {
char *dest = malloc(sizeof(char) * strlen(src)); char *dest = malloc(sizeof(char) * (strlen(src) + 1));
strcpy(dest, src); strcpy(dest, src);
return dest; return dest;
} }