--- rpl/src/interface_cas.cpp 2011/08/09 11:31:36 1.15 +++ rpl/src/interface_cas.cpp 2018/12/21 10:56:22 1.58 @@ -1,7 +1,7 @@ /* ================================================================================ - RPL/2 (R) version 4.1.3 - Copyright (C) 1989-2011 Dr. BERTRAND Joël + RPL/2 (R) version 4.1.29 + Copyright (C) 1989-2018 Dr. BERTRAND Joël This file is part of RPL/2. @@ -21,7 +21,24 @@ #ifdef RPLCAS -# include "giac.h" + +// Giac inclut et définit sem_t. Or l'émulation +// des IPCS POSIX requiert une redéfinition de sem_t. + +# ifdef IPCS_SYSV +// NetBSD : _SEMAPHORE_H_ +# define _SEMAPHORE_H_ +// Linux : _SEMAPHORE_H +# define _SEMAPHORE_H +# endif + +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wstrict-aliasing" +# pragma GCC diagnostic ignored "-Wunused-parameter" +# pragma GCC diagnostic ignored "-Wempty-body" +# pragma GCC diagnostic ignored "-Wunknown-pragmas" +# include "giacPCH.h" +# pragma GCC diagnostic pop # undef PACKAGE # undef PACKAGE_NAME @@ -57,14 +74,17 @@ liberation_contexte_cas(struct_processus { if (s_etat_processus->contexte_cas != NULL) { +# ifdef RPLCAS delete reinterpret_cast( s_etat_processus->contexte_cas); +# endif s_etat_processus->contexte_cas = NULL; } return; } +#ifdef RPLCAS static unsigned char * conversion_rpl_vers_cas(struct_processus *s_etat_processus, struct_objet **s_objet) @@ -72,7 +92,6 @@ conversion_rpl_vers_cas(struct_processus logical1 drapeau; struct_liste_chainee *l_element_courant; - struct_liste_chainee *l_element_precedent; struct_objet *s_objet_temporaire; @@ -203,7 +222,6 @@ conversion_rpl_vers_cas(struct_processus } } - l_element_precedent = l_element_courant; l_element_courant = l_element_courant->suivant; } } @@ -217,7 +235,7 @@ conversion_rpl_vers_cas(struct_processus strstr(reinterpret_cast(index), (const char *) "relax"))) != NULL) { - strncpy(reinterpret_cast(index), " +", 5); + memcpy(reinterpret_cast(index), " +", 5); } // Si le résultat vaut infinity, on rajoute le signe +. @@ -257,7 +275,6 @@ conversion_cas_vers_rpl(struct_processus logical1 drapeau; struct_liste_chainee *l_element_courant; - struct_liste_chainee *l_element_precedent; struct_objet *s_objet; @@ -330,7 +347,6 @@ conversion_cas_vers_rpl(struct_processus if ((s_objet->type == ALG) || (s_objet->type == RPN)) { - l_element_precedent = NULL; l_element_courant = reinterpret_cast( s_objet->objet); @@ -376,7 +392,6 @@ conversion_cas_vers_rpl(struct_processus } } - l_element_precedent = l_element_courant; l_element_courant = l_element_courant->suivant; } } @@ -389,6 +404,7 @@ conversion_cas_vers_rpl(struct_processus return; } +#endif /* @@ -404,11 +420,13 @@ conversion_cas_vers_rpl(struct_processus ================================================================================ */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" void interface_cas(struct_processus *s_etat_processus, enum t_rplcas_commandes commande) { -# ifdef RPLCAS +#ifdef RPLCAS struct_objet *s_objet_argument_1; struct_objet *s_objet_argument_2; struct_objet *s_objet_temporaire; @@ -430,7 +448,7 @@ interface_cas(struct_processus *s_etat_p { s_etat_processus->contexte_cas = new giac::context; } - catch(bad_alloc exception) + catch(bad_alloc &exception) { s_etat_processus->erreur_systeme = d_es_allocation_memoire; return; @@ -504,7 +522,7 @@ interface_cas(struct_processus *s_etat_p reinterpret_cast(const_cast( chaine.c_str()))); } - catch(bad_alloc exception) + catch(bad_alloc &exception) { s_etat_processus->erreur_systeme = d_es_allocation_memoire; } @@ -561,6 +579,8 @@ interface_cas(struct_processus *s_etat_p l_element_courant = reinterpret_cast (s_objet_argument_1->objet); position = 1; + argument_1 = NULL; + argument_3 = NULL; argument_4 = NULL; while(l_element_courant != NULL) @@ -663,7 +683,7 @@ interface_cas(struct_processus *s_etat_p reinterpret_cast(const_cast( chaine.c_str()))); } - catch(bad_alloc exception) + catch(bad_alloc &exception) { s_etat_processus->erreur_systeme = d_es_allocation_memoire; } @@ -686,7 +706,6 @@ interface_cas(struct_processus *s_etat_p } return; - #else if (s_etat_processus->langue == 'F') @@ -704,5 +723,6 @@ interface_cas(struct_processus *s_etat_p #endif } +#pragma GCC diagnostic pop // vim: ts=4