diff --git a/gcc/cobol/ChangeLog b/gcc/cobol/ChangeLog index a13af4917793fad4e5f0658a283cffa7a9dcc2da..d0b26e90b882fbc61e01e68522ca463a54d14357 100644 --- a/gcc/cobol/ChangeLog +++ b/gcc/cobol/ChangeLog @@ -56,6 +56,8 @@ * Normalize #includes in symfind.cc * Normalize #includes in cdf-copy.cc and copybook.h * Normalize #includes in lexio.cc + * Normalize #includes in cdf.y + diff --git a/gcc/cobol/cdf.y b/gcc/cobol/cdf.y index db692e9647e1eda5af2ce8750bd2ab0cb3902695..9cfe75824aeb8f6ef4505f24dd9cf8fb086e36be 100644 --- a/gcc/cobol/cdf.y +++ b/gcc/cobol/cdf.y @@ -28,25 +28,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ %{ -#include "util.h" -#include "copybook-old.h" -#include "ec.h" + +#include "cobol-system.h" +#include "copybook.h" #include "symbols.h" #include "exceptl.h" #include "exceptg.h" - -#include <ctype.h> -#include <fcntl.h> -#include <regex.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include <sys/types.h> -#include <sys/wait.h> - -#include <algorithm> +#include "cbldiag.h" #define COUNT_OF(X) (sizeof(X) / sizeof(X[0])) @@ -54,7 +42,7 @@ copybook_t copybook; static inline bool is_word( int c ) { - return c == '_' || isalnum(c); + return c == '_' || ISALNUM(c); } static std::pair<long long, bool> @@ -76,8 +64,6 @@ const char * cdf_token_str( int token ); extern int yylineno, yyleng; extern char *yytext; -#include "cbldiag.h" - static int ydflex(void); void ydferror( char const *s, int ); @@ -87,8 +73,8 @@ void ydferror( char const *s, int ); %code requires { #include "cdfval.h" - #include <map> - #include <string> +// #include <map> +// #include <string> using std::map; static map<std::string, cdfval_t> dictionary; @@ -140,7 +126,6 @@ void ydferror( char const *s, int ); } %{ -#include <map> static char *display_msg; const char * keyword_str( int token ); @@ -349,13 +334,13 @@ cdf_display: CDF_DISPLAY strings { strings: LITERAL { if( -1 == asprintf(&display_msg, "%s", $1) ){ - yyerrorv("%s", strerror(errno)); + yyerrorv("%s", xstrerror(errno)); } } | strings LITERAL { char *p = display_msg; if(-1 == asprintf(&display_msg, "%s %s", p, $2) ){ - yyerrorv("%s", strerror(errno)); + yyerrorv("%s", xstrerror(errno)); } free(p); } @@ -719,7 +704,7 @@ namelit: name { char *s; if( -1 == asprintf( &s, "%s%s", $1, $2 ) ) { - yyerrorv("%s", strerror(errno)); + yyerrorv("%s", xstrerror(errno)); } free(const_cast<char*>($1)); free(const_cast<char*>($2)); @@ -736,7 +721,7 @@ name: NAME { char *s; if( -1 == asprintf( &s, "%s %s %s", $1, $2, $3 ) ) { - yyerrorv("%s", strerror(errno)); + yyerrorv("%s", xstrerror(errno)); } assert($$ == $1); free(const_cast<char*>($1)); @@ -753,7 +738,7 @@ subscripts: subscript { char *s; if( -1 == asprintf( &s, "%s%s", $1, $2 ) ) { - yyerrorv("%s", strerror(errno)); + yyerrorv("%s", xstrerror(errno)); } if( $$ != $1 ) free(const_cast<char*>($$)); free(const_cast<char*>($1)); @@ -766,7 +751,7 @@ subscript: SUBSCRIPT { char *s; if( -1 == asprintf( &s, "%s%s%s", $1, $2, $3 ) ) { - yyerrorv("%s", strerror(errno)); + yyerrorv("%s", xstrerror(errno)); } free(const_cast<char*>($1)); free(const_cast<char*>($2)); @@ -794,7 +779,7 @@ defined_cmd( const char arg[] ) { cdfval_t value(1); - char *name = strdup(arg); + char *name = xstrdup(arg); char *p = strchr(name, '='); if(p) { *p++ = '\0';