bfd/ChangeLog 2014-12-22 Jan Kratochvil * coffgen.c (N_TMASK, N_BTSHFT): Redefine them on _WIN64. * cofflink.c (N_TMASK, N_BTSHFT, N_BTMASK): Redefine them on _WIN64. * peXXigen.c (max, min): Define them only if they do not yet exist. (IMAGE_NT_OPTIONAL_HDR_MAGIC): Rename to ... (IMAGE_NT_OPTIONAL_HDR32_MAGIC): ... here. gdb/ChangeLog 2014-12-22 Jan Kratochvil * ada-exp.y: Rename symbols conflicting with MS-Windows to TOK_*. * ada-lang.c: Rename ada_inferior_data::exception_info to ada_exception_info due to its conflict on MS-Windows. * ada-lex.l: Rename symbols conflicting with MS-Windows to TOK_*. * c-exp.y: Likewise. * coff-pe-read.c: Do not define symbols conflicting with MS-Windows on _WIN64. * coffread.c: Redefine symbols conflicting with MS-Windows on _WIN64. * cp-name-parser.y: Rename symbols conflicting with MS-Windows to TOK_*. * d-exp.y: Likewise. * defs.h: Include sys/time.h. * f-exp.y: Rename symbols conflicting with MS-Windows to TOK_*. * go-exp.y: Likewise. * jv-exp.y: Likewise. * m2-exp.y: Likewise. * p-exp.y: Likewise. * ser-tcp.c (close): Redefine it on _WIN64. (wait_for_connect): Use TIMEVAL. * symfile.c (SIZE): Rename to ... (OVLY_SIZE): ... here. gdb/gdbserver/ChangeLog 2014-12-22 Jan Kratochvil * remote-utils.c (input_interrupt): Use TIMEVAL. include/coff/ChangeLog 2014-12-22 Jan Kratochvil * ecoff.h: Do not define symbols conflicting with MS-Windows on _WIN64. * internal.h: Include windows.h on _WIN64. Do not define symbols conflicting with MS-Windows on _WIN64. * pe.h: Do not define symbols conflicting with MS-Windows on _WIN64. --- old/orig/bfd/coffgen.c 2014-12-14 02:48:36.000000000 +0100 +++ ./bfd/coffgen.c 2014-12-22 20:08:32.551511966 +0100 @@ -1530,6 +1530,10 @@ coff_pointerize_aux (bfd *abfd, BFD_ASSERT (! auxent->is_sym); /* Otherwise patch up. */ +#ifdef _WIN64 +# undef N_TMASK +# undef N_BTSHFT +#endif #define N_TMASK coff_data (abfd)->local_n_tmask #define N_BTSHFT coff_data (abfd)->local_n_btshft --- old/orig/bfd/cofflink.c 2014-12-14 02:48:36.000000000 +0100 +++ ./bfd/cofflink.c 2014-12-22 20:07:22.583498498 +0100 @@ -50,6 +50,11 @@ static bfd_boolean coff_link_add_symbols variables with the appropriate names, and with values from the coff_data (abfd) structure. */ +#ifdef _WIN64 +# undef N_TMASK +# undef N_BTSHFT +# undef N_BTMASK +#endif #define N_TMASK n_tmask #define N_BTSHFT n_btshft #define N_BTMASK n_btmask diff -dup -rup orig/bfd/peXXigen.c origx/bfd/peXXigen.c --- orig/bfd/peXXigen.c 2014-12-14 02:48:37.000000000 +0100 +++ origx/bfd/peXXigen.c 2014-12-22 21:43:43.346869824 +0100 @@ -2394,8 +2394,12 @@ rsrc_print_resource_entries (FILE * return regions->section_start + (addr - rva_bias) + size; } -#define max(a,b) ((a) > (b) ? (a) : (b)) -#define min(a,b) ((a) < (b) ? (a) : (b)) +#ifndef max +# define max(a,b) ((a) > (b) ? (a) : (b)) +#endif +#ifndef min +# define min(a,b) ((a) < (b) ? (a) : (b)) +#endif static bfd_byte * rsrc_print_resource_directory (FILE * file, @@ -2722,8 +2726,8 @@ _bfd_XX_print_private_bfd_data_common (b fprintf (file, "\nTime/Date\t\t%s", ctime (&t)); } -#ifndef IMAGE_NT_OPTIONAL_HDR_MAGIC -# define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b +#ifndef IMAGE_NT_OPTIONAL_HDR32_MAGIC +# define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b #endif #ifndef IMAGE_NT_OPTIONAL_HDR64_MAGIC # define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b @@ -2734,7 +2738,7 @@ _bfd_XX_print_private_bfd_data_common (b switch (i->Magic) { - case IMAGE_NT_OPTIONAL_HDR_MAGIC: + case IMAGE_NT_OPTIONAL_HDR32_MAGIC: name = "PE32"; break; case IMAGE_NT_OPTIONAL_HDR64_MAGIC: --- old/orig/gdb/ada-exp.y 2014-12-14 02:48:38.000000000 +0100 +++ ./gdb/ada-exp.y 2014-12-22 20:26:50.900743191 +0100 @@ -192,8 +192,8 @@ static struct type *type_system_address %type aggregate_component_list %type var_or_type -%token INT NULL_PTR CHARLIT -%token FLOAT +%token TOK_INT NULL_PTR CHARLIT +%token TOK_FLOAT %token TRUEKEYWORD FALSEKEYWORD %token COLONCOLON %token STRING NAME DOT_ID @@ -210,7 +210,7 @@ static struct type *type_system_address %nonassoc ASSIGN %left _AND_ OR XOR THEN ELSE -%left '=' NOTEQUAL '<' '>' LEQ GEQ IN DOTDOT +%left '=' NOTEQUAL '<' '>' LEQ GEQ TOK_IN DOTDOT %left '@' %left '+' '-' '&' %left UNARY @@ -433,14 +433,14 @@ relation : simple_exp LEQ simple_exp { write_exp_elt_opcode (pstate, BINOP_LEQ); } ; -relation : simple_exp IN simple_exp DOTDOT simple_exp +relation : simple_exp TOK_IN simple_exp DOTDOT simple_exp { write_exp_elt_opcode (pstate, TERNOP_IN_RANGE); } - | simple_exp IN primary TICK_RANGE tick_arglist + | simple_exp TOK_IN primary TICK_RANGE tick_arglist { write_exp_elt_opcode (pstate, BINOP_IN_BOUNDS); write_exp_elt_longcst (pstate, (LONGEST) $5); write_exp_elt_opcode (pstate, BINOP_IN_BOUNDS); } - | simple_exp IN var_or_type %prec TICK_ACCESS + | simple_exp TOK_IN var_or_type %prec TICK_ACCESS { if ($3 == NULL) error (_("Right operand of 'in' must be type")); @@ -448,17 +448,17 @@ relation : simple_exp IN simple_exp DOTD write_exp_elt_type (pstate, $3); write_exp_elt_opcode (pstate, UNOP_IN_RANGE); } - | simple_exp NOT IN simple_exp DOTDOT simple_exp + | simple_exp NOT TOK_IN simple_exp DOTDOT simple_exp { write_exp_elt_opcode (pstate, TERNOP_IN_RANGE); write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); } - | simple_exp NOT IN primary TICK_RANGE tick_arglist + | simple_exp NOT TOK_IN primary TICK_RANGE tick_arglist { write_exp_elt_opcode (pstate, BINOP_IN_BOUNDS); write_exp_elt_longcst (pstate, (LONGEST) $6); write_exp_elt_opcode (pstate, BINOP_IN_BOUNDS); write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); } - | simple_exp NOT IN var_or_type %prec TICK_ACCESS + | simple_exp NOT TOK_IN var_or_type %prec TICK_ACCESS { if ($4 == NULL) error (_("Right operand of 'in' must be type")); @@ -567,7 +567,7 @@ primary : primary TICK_ACCESS tick_arglist : %prec '(' { $$ = 1; } - | '(' INT ')' + | '(' TOK_INT ')' { $$ = $2.val; } ; @@ -591,7 +591,7 @@ opt_type_prefix : ; -primary : INT +primary : TOK_INT { write_int (pstate, (LONGEST) $1.val, $1.type); } ; @@ -603,7 +603,7 @@ primary : CHARLIT } ; -primary : FLOAT +primary : TOK_FLOAT { write_exp_elt_opcode (pstate, OP_DOUBLE); write_exp_elt_type (pstate, $1.type); write_exp_elt_dblcst (pstate, $1.dval); --- old/orig/gdb/ada-lang.c 2014-12-14 02:48:38.000000000 +0100 +++ ./gdb/ada-lang.c 2014-12-22 20:44:15.484005755 +0100 @@ -382,7 +382,7 @@ struct ada_inferior_data /* The exception_support_info data. This data is used to determine how to implement support for Ada exception catchpoints in a given inferior. */ - const struct exception_support_info *exception_info; + const struct exception_support_info *ada_exception_info; }; /* Our key to this module's inferior data. */ @@ -11530,7 +11530,7 @@ ada_has_this_exception_support (const st /* Inspect the Ada runtime and determine which exception info structure should be used to provide support for exception catchpoints. - This function will always set the per-inferior exception_info, + This function will always set the per-inferior ada_exception_info, or raise an error. */ static void @@ -11539,20 +11539,20 @@ ada_exception_support_info_sniffer (void struct ada_inferior_data *data = get_ada_inferior_data (current_inferior ()); /* If the exception info is already known, then no need to recompute it. */ - if (data->exception_info != NULL) + if (data->ada_exception_info != NULL) return; /* Check the latest (default) exception support info. */ if (ada_has_this_exception_support (&default_exception_support_info)) { - data->exception_info = &default_exception_support_info; + data->ada_exception_info = &default_exception_support_info; return; } /* Try our fallback exception suport info. */ if (ada_has_this_exception_support (&exception_support_info_fallback)) { - data->exception_info = &exception_support_info_fallback; + data->ada_exception_info = &exception_support_info_fallback; return; } @@ -11712,7 +11712,7 @@ ada_unhandled_exception_name_addr_from_r make_cleanup (xfree, func_name); if (strcmp (func_name, - data->exception_info->catch_exception_sym) == 0) + data->ada_exception_info->catch_exception_sym) == 0) break; /* We found the frame we were looking for... */ fi = get_prev_frame (fi); } @@ -11745,7 +11745,7 @@ ada_exception_name_addr_1 (enum ada_exce break; case ada_catch_exception_unhandled: - return data->exception_info->unhandled_exception_name_addr (); + return data->ada_exception_info->unhandled_exception_name_addr (); break; case ada_catch_assert: @@ -12477,18 +12477,18 @@ ada_exception_sym_name (enum ada_excepti { struct ada_inferior_data *data = get_ada_inferior_data (current_inferior ()); - gdb_assert (data->exception_info != NULL); + gdb_assert (data->ada_exception_info != NULL); switch (ex) { case ada_catch_exception: - return (data->exception_info->catch_exception_sym); + return (data->ada_exception_info->catch_exception_sym); break; case ada_catch_exception_unhandled: - return (data->exception_info->catch_exception_unhandled_sym); + return (data->ada_exception_info->catch_exception_unhandled_sym); break; case ada_catch_assert: - return (data->exception_info->catch_assert_sym); + return (data->ada_exception_info->catch_assert_sym); break; default: internal_error (__FILE__, __LINE__, --- old/orig/gdb/ada-lex.l 2014-12-14 02:48:38.000000000 +0100 +++ ./gdb/ada-lex.l 2014-12-22 20:31:00.939803092 +0100 @@ -182,7 +182,7 @@ thread{WHITE}+{DIG} { abs { return ABS; } and { return _AND_; } else { return ELSE; } -in { return IN; } +in { return TOK_IN; } mod { return MOD; } new { return NEW; } not { return NOT; } @@ -319,7 +319,7 @@ canonicalizeNumeral (char *s1, const cha /* Interprets the prefix of NUM that consists of digits of the given BASE as an integer of that BASE, with the string EXP as an exponent. - Puts value in yylval, and returns INT, if the string is valid. Causes + Puts value in yylval, and returns TOK_INT, if the string is valid. Causes an error if the number is improperly formated. BASE, if NULL, defaults to "10", and EXP to "1". The EXP does not contain a leading 'e' or 'E'. */ @@ -383,13 +383,13 @@ processInt (struct parser_state *par_sta - (LONGEST_SIGN>>1) - (LONGEST_SIGN>>1); else yylval.typed_val.val = (LONGEST) result; - return INT; + return TOK_INT; } else yylval.typed_val.type = type_long_long (par_state); yylval.typed_val.val = (LONGEST) result; - return INT; + return TOK_INT; } static int @@ -405,7 +405,7 @@ processReal (struct parser_state *par_st / TARGET_CHAR_BIT) yylval.typed_val_float.type = type_long_double (par_state); - return FLOAT; + return TOK_FLOAT; } --- old/orig/gdb/c-exp.y 2014-12-14 02:48:38.000000000 +0100 +++ ./gdb/c-exp.y 2014-12-22 20:24:33.564713894 +0100 @@ -195,8 +195,8 @@ static void c_print_token (FILE *file, i %type ptr_operator_ts abs_decl direct_abs_decl -%token INT -%token FLOAT +%token TOK_INT +%token TFLOAT %token DECFLOAT /* Both NAME and TYPENAME tokens represent symbols in the input, @@ -210,7 +210,7 @@ static void c_print_token (FILE *file, i %token STRING %token NSSTRING /* ObjC Foundation "NSString" literal */ %token SELECTOR /* ObjC "@selector" pseudo-operator */ -%token CHAR +%token TOK_CHAR %token NAME /* BLOCKNAME defined below to give it higher precedence. */ %token UNKNOWN_CPP_NAME %token COMPLETE @@ -236,8 +236,8 @@ static void c_print_token (FILE *file, i %token OPERATOR %token STRUCT CLASS UNION ENUM SIZEOF UNSIGNED COLONCOLON %token TEMPLATE -%token ERROR -%token NEW DELETE +%token TOK_ERROR +%token NEW TOK_DELETE %type operator %token REINTERPRET_CAST DYNAMIC_CAST STATIC_CAST CONST_CAST %token ENTRY @@ -247,7 +247,7 @@ static void c_print_token (FILE *file, i /* Special type cases, put in to allow the parser to distinguish different legal basetypes. */ -%token SIGNED_KEYWORD LONG SHORT INT_KEYWORD CONST_KEYWORD VOLATILE_KEYWORD DOUBLE_KEYWORD +%token SIGNED_KEYWORD TOK_LONG TOK_SHORT INT_KEYWORD CONST_KEYWORD VOLATILE_KEYWORD DOUBLE_KEYWORD %token VARIABLE @@ -727,14 +727,14 @@ exp : exp ASSIGN_MODIFY exp BINOP_ASSIGN_MODIFY); } ; -exp : INT +exp : TOK_INT { write_exp_elt_opcode (pstate, OP_LONG); write_exp_elt_type (pstate, $1.type); write_exp_elt_longcst (pstate, (LONGEST) ($1.val)); write_exp_elt_opcode (pstate, OP_LONG); } ; -exp : CHAR +exp : TOK_CHAR { struct stoken_vector vec; vec.len = 1; @@ -756,7 +756,7 @@ exp : NAME_OR_INT ; -exp : FLOAT +exp : TFLOAT { write_exp_elt_opcode (pstate, OP_DOUBLE); write_exp_elt_type (pstate, $1.type); write_exp_elt_dblcst (pstate, $1.dval); @@ -1192,9 +1192,9 @@ array_mod: '[' ']' { $$ = -1; } | OBJC_LBRAC ']' { $$ = -1; } - | '[' INT ']' + | '[' TOK_INT ']' { $$ = $2.val; } - | OBJC_LBRAC INT ']' + | OBJC_LBRAC TOK_INT ']' { $$ = $2.val; } ; @@ -1222,103 +1222,103 @@ typebase /* Implements (approximately): { $$ = lookup_signed_typename (parse_language (pstate), parse_gdbarch (pstate), "int"); } - | LONG + | TOK_LONG { $$ = lookup_signed_typename (parse_language (pstate), parse_gdbarch (pstate), "long"); } - | SHORT + | TOK_SHORT { $$ = lookup_signed_typename (parse_language (pstate), parse_gdbarch (pstate), "short"); } - | LONG INT_KEYWORD + | TOK_LONG INT_KEYWORD { $$ = lookup_signed_typename (parse_language (pstate), parse_gdbarch (pstate), "long"); } - | LONG SIGNED_KEYWORD INT_KEYWORD + | TOK_LONG SIGNED_KEYWORD INT_KEYWORD { $$ = lookup_signed_typename (parse_language (pstate), parse_gdbarch (pstate), "long"); } - | LONG SIGNED_KEYWORD + | TOK_LONG SIGNED_KEYWORD { $$ = lookup_signed_typename (parse_language (pstate), parse_gdbarch (pstate), "long"); } - | SIGNED_KEYWORD LONG INT_KEYWORD + | SIGNED_KEYWORD TOK_LONG INT_KEYWORD { $$ = lookup_signed_typename (parse_language (pstate), parse_gdbarch (pstate), "long"); } - | UNSIGNED LONG INT_KEYWORD + | UNSIGNED TOK_LONG INT_KEYWORD { $$ = lookup_unsigned_typename (parse_language (pstate), parse_gdbarch (pstate), "long"); } - | LONG UNSIGNED INT_KEYWORD + | TOK_LONG UNSIGNED INT_KEYWORD { $$ = lookup_unsigned_typename (parse_language (pstate), parse_gdbarch (pstate), "long"); } - | LONG UNSIGNED + | TOK_LONG UNSIGNED { $$ = lookup_unsigned_typename (parse_language (pstate), parse_gdbarch (pstate), "long"); } - | LONG LONG + | TOK_LONG TOK_LONG { $$ = lookup_signed_typename (parse_language (pstate), parse_gdbarch (pstate), "long long"); } - | LONG LONG INT_KEYWORD + | TOK_LONG TOK_LONG INT_KEYWORD { $$ = lookup_signed_typename (parse_language (pstate), parse_gdbarch (pstate), "long long"); } - | LONG LONG SIGNED_KEYWORD INT_KEYWORD + | TOK_LONG TOK_LONG SIGNED_KEYWORD INT_KEYWORD { $$ = lookup_signed_typename (parse_language (pstate), parse_gdbarch (pstate), "long long"); } - | LONG LONG SIGNED_KEYWORD + | TOK_LONG TOK_LONG SIGNED_KEYWORD { $$ = lookup_signed_typename (parse_language (pstate), parse_gdbarch (pstate), "long long"); } - | SIGNED_KEYWORD LONG LONG + | SIGNED_KEYWORD TOK_LONG TOK_LONG { $$ = lookup_signed_typename (parse_language (pstate), parse_gdbarch (pstate), "long long"); } - | SIGNED_KEYWORD LONG LONG INT_KEYWORD + | SIGNED_KEYWORD TOK_LONG TOK_LONG INT_KEYWORD { $$ = lookup_signed_typename (parse_language (pstate), parse_gdbarch (pstate), "long long"); } - | UNSIGNED LONG LONG + | UNSIGNED TOK_LONG TOK_LONG { $$ = lookup_unsigned_typename (parse_language (pstate), parse_gdbarch (pstate), "long long"); } - | UNSIGNED LONG LONG INT_KEYWORD + | UNSIGNED TOK_LONG TOK_LONG INT_KEYWORD { $$ = lookup_unsigned_typename (parse_language (pstate), parse_gdbarch (pstate), "long long"); } - | LONG LONG UNSIGNED + | TOK_LONG TOK_LONG UNSIGNED { $$ = lookup_unsigned_typename (parse_language (pstate), parse_gdbarch (pstate), "long long"); } - | LONG LONG UNSIGNED INT_KEYWORD + | TOK_LONG TOK_LONG UNSIGNED INT_KEYWORD { $$ = lookup_unsigned_typename (parse_language (pstate), parse_gdbarch (pstate), "long long"); } - | SHORT INT_KEYWORD + | TOK_SHORT INT_KEYWORD { $$ = lookup_signed_typename (parse_language (pstate), parse_gdbarch (pstate), "short"); } - | SHORT SIGNED_KEYWORD INT_KEYWORD + | TOK_SHORT SIGNED_KEYWORD INT_KEYWORD { $$ = lookup_signed_typename (parse_language (pstate), parse_gdbarch (pstate), "short"); } - | SHORT SIGNED_KEYWORD + | TOK_SHORT SIGNED_KEYWORD { $$ = lookup_signed_typename (parse_language (pstate), parse_gdbarch (pstate), "short"); } - | UNSIGNED SHORT INT_KEYWORD + | UNSIGNED TOK_SHORT INT_KEYWORD { $$ = lookup_unsigned_typename (parse_language (pstate), parse_gdbarch (pstate), "short"); } - | SHORT UNSIGNED + | TOK_SHORT UNSIGNED { $$ = lookup_unsigned_typename (parse_language (pstate), parse_gdbarch (pstate), "short"); } - | SHORT UNSIGNED INT_KEYWORD + | TOK_SHORT UNSIGNED INT_KEYWORD { $$ = lookup_unsigned_typename (parse_language (pstate), parse_gdbarch (pstate), "short"); } @@ -1328,7 +1328,7 @@ typebase /* Implements (approximately): "double", (struct block *) NULL, 0); } - | LONG DOUBLE_KEYWORD + | TOK_LONG DOUBLE_KEYWORD { $$ = lookup_typename (parse_language (pstate), parse_gdbarch (pstate), "long double", @@ -1428,7 +1428,7 @@ typename: TYPENAME parse_gdbarch (pstate), "int"); } - | LONG + | TOK_LONG { $$.stoken.ptr = "long"; $$.stoken.length = 4; @@ -1436,7 +1436,7 @@ typename: TYPENAME parse_gdbarch (pstate), "long"); } - | SHORT + | TOK_SHORT { $$.stoken.ptr = "short"; $$.stoken.length = 5; @@ -1503,15 +1503,15 @@ const_or_volatile_noopt: const_and_vol operator: OPERATOR NEW { $$ = operator_stoken (" new"); } - | OPERATOR DELETE + | OPERATOR TOK_DELETE { $$ = operator_stoken (" delete"); } | OPERATOR NEW '[' ']' { $$ = operator_stoken (" new[]"); } - | OPERATOR DELETE '[' ']' + | OPERATOR TOK_DELETE '[' ']' { $$ = operator_stoken (" delete[]"); } | OPERATOR NEW OBJC_LBRAC ']' { $$ = operator_stoken (" new[]"); } - | OPERATOR DELETE OBJC_LBRAC ']' + | OPERATOR TOK_DELETE OBJC_LBRAC ']' { $$ = operator_stoken (" delete[]"); } | OPERATOR '+' { $$ = operator_stoken ("+"); } @@ -1819,8 +1819,8 @@ parse_number (struct parser_state *par_s if (! parse_c_float (parse_gdbarch (par_state), p, len, &putithere->typed_val_float.dval, &putithere->typed_val_float.type)) - return ERROR; - return FLOAT; + return TOK_ERROR; + return TFLOAT; } /* Handle base-switching prefixes 0x, 0t, 0d, 0 */ @@ -1874,7 +1874,7 @@ parse_number (struct parser_state *par_s if (c >= '0' && c <= '9') { if (found_suffix) - return ERROR; + return TOK_ERROR; n += i = c - '0'; } else @@ -1882,7 +1882,7 @@ parse_number (struct parser_state *par_s if (base > 10 && c >= 'a' && c <= 'f') { if (found_suffix) - return ERROR; + return TOK_ERROR; n += i = c - 'a' + 10; } else if (c == 'l') @@ -1896,10 +1896,10 @@ parse_number (struct parser_state *par_s found_suffix = 1; } else - return ERROR; /* Char not a digit */ + return TOK_ERROR; /* Char not a digit */ } if (i >= base) - return ERROR; /* Invalid digit in this base */ + return TOK_ERROR; /* Invalid digit in this base */ /* Portably test for overflow (only works for nonzero values, so make a second check for zero). FIXME: Can't we just make n and prevn @@ -1982,7 +1982,7 @@ parse_number (struct parser_state *par_s putithere->typed_val_int.type = signed_type; } - return INT; + return TOK_INT; } /* Temporary obstack used for holding strings. */ @@ -2157,7 +2157,7 @@ c_parse_escape (const char **ptr, struct character may be wide or unicode. *OUTPTR is set to just after the end of the literal in the input string. The resulting token is stored in VALUE. This returns a token value, either STRING or - CHAR, depending on what was parsed. *HOST_CHARS is set to the + TOK_CHAR, depending on what was parsed. *HOST_CHARS is set to the number of host characters in the literal. */ static int parse_string_or_char (const char *tokptr, const char **outptr, @@ -2252,7 +2252,7 @@ parse_string_or_char (const char *tokptr *outptr = tokptr; - return quote == '"' ? (is_objc ? NSSTRING : STRING) : CHAR; + return quote == '"' ? (is_objc ? NSSTRING : STRING) : TOK_CHAR; } /* This is used to associate some attributes with a token. */ @@ -2326,14 +2326,14 @@ static const struct token ident_tokens[] {"false", FALSEKEYWORD, OP_NULL, FLAG_CXX}, {"class", CLASS, OP_NULL, FLAG_CXX}, {"union", UNION, OP_NULL, 0}, - {"short", SHORT, OP_NULL, 0}, + {"short", TOK_SHORT, OP_NULL, 0}, {"const", CONST_KEYWORD, OP_NULL, 0}, {"enum", ENUM, OP_NULL, 0}, - {"long", LONG, OP_NULL, 0}, + {"long", TOK_LONG, OP_NULL, 0}, {"true", TRUEKEYWORD, OP_NULL, FLAG_CXX}, {"int", INT_KEYWORD, OP_NULL, 0}, {"new", NEW, OP_NULL, FLAG_CXX}, - {"delete", DELETE, OP_NULL, FLAG_CXX}, + {"delete", TOK_DELETE, OP_NULL, FLAG_CXX}, {"operator", OPERATOR, OP_NULL, FLAG_CXX}, {"and", ANDAND, BINOP_END, FLAG_CXX}, @@ -2637,7 +2637,7 @@ lex_one_token (struct parser_state *par_ } toktype = parse_number (par_state, tokstart, p - tokstart, got_dot|got_e, &yylval); - if (toktype == ERROR) + if (toktype == TOK_ERROR) { char *err_copy = (char *) alloca (p - tokstart + 1); @@ -2713,7 +2713,7 @@ lex_one_token (struct parser_state *par_ int host_len; int result = parse_string_or_char (tokstart, &lexptr, &yylval.tsval, &host_len); - if (result == CHAR) + if (result == TOK_CHAR) { if (host_len == 0) error (_("Empty character constant.")); @@ -2972,7 +2972,7 @@ classify_name (struct parser_state *par_ YYSTYPE newlval; /* Its value is ignored. */ int hextype = parse_number (par_state, copy, yylval.sval.length, 0, &newlval); - if (hextype == INT) + if (hextype == TOK_INT) { yylval.ssym.sym = sym; yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL; @@ -3009,7 +3009,7 @@ classify_inner_name (struct parser_state type = check_typedef (context); if (!type_aggregate_p (type)) - return ERROR; + return TOK_ERROR; copy = copy_name (yylval.ssym.stoken); yylval.ssym.sym = cp_lookup_nested_symbol (type, copy, block); @@ -3027,7 +3027,7 @@ classify_inner_name (struct parser_state return TYPENAME; } - return ERROR; + return TOK_ERROR; } switch (SYMBOL_CLASS (yylval.ssym.sym)) @@ -3046,7 +3046,7 @@ classify_inner_name (struct parser_state return TYPENAME; } } - return ERROR; + return TOK_ERROR; case LOC_TYPEDEF: yylval.tsym.type = SYMBOL_TYPE (yylval.ssym.sym);; @@ -3273,13 +3273,13 @@ c_print_token (FILE *file, int type, YYS { switch (type) { - case INT: + case TOK_INT: fprintf (file, "typed_val_int<%s, %s>", TYPE_SAFE_NAME (value.typed_val_int.type), pulongest (value.typed_val_int.val)); break; - case CHAR: + case TOK_CHAR: case STRING: { char *copy = alloca (value.tsval.length + 1); --- old/orig/gdb/coff-pe-read.c 2014-12-14 02:48:38.000000000 +0100 +++ ./gdb/coff-pe-read.c 2014-12-22 20:41:57.160970473 +0100 @@ -57,9 +57,11 @@ struct read_pe_section_data char *section_name; /* Recorded section name. */ }; +#ifndef _WIN64 #define IMAGE_SCN_CNT_CODE 0x20 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x40 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x80 +#endif #define PE_SECTION_INDEX_TEXT 0 #define PE_SECTION_INDEX_DATA 1 #define PE_SECTION_INDEX_BSS 2 --- old/orig/gdb/coffread.c 2014-12-14 02:48:38.000000000 +0100 +++ ./gdb/coffread.c 2014-12-22 20:41:36.096965101 +0100 @@ -106,6 +106,12 @@ static unsigned local_n_btshft; static unsigned local_n_tmask; static unsigned local_n_tshift; +#ifdef _WIN64 +# undef N_BTMASK +# undef N_BTSHFT +# undef N_TMASK +# undef N_TSHIFT +#endif #define N_BTMASK local_n_btmask #define N_BTSHFT local_n_btshft #define N_TMASK local_n_tmask --- old/orig/gdb/cp-name-parser.y 2014-12-14 02:48:38.000000000 +0100 +++ ./gdb/cp-name-parser.y 2014-12-22 20:26:04.620733318 +0100 @@ -302,22 +302,22 @@ make_name (const char *name, int len) %type int_part int_seq -%token INT -%token FLOAT +%token TOK_INT +%token TOK_FLOAT %token NAME %type name %token STRUCT CLASS UNION ENUM SIZEOF UNSIGNED COLONCOLON %token TEMPLATE -%token ERROR -%token NEW DELETE OPERATOR +%token TOK_ERROR +%token NEW TOK_DELETE OPERATOR %token STATIC_CAST REINTERPRET_CAST DYNAMIC_CAST /* Special type cases, put in to allow the parser to distinguish different legal basetypes. */ -%token SIGNED_KEYWORD LONG SHORT INT_KEYWORD CONST_KEYWORD VOLATILE_KEYWORD DOUBLE_KEYWORD BOOL -%token ELLIPSIS RESTRICT VOID FLOAT_KEYWORD CHAR WCHAR_T +%token SIGNED_KEYWORD TOK_LONG TOK_SHORT INT_KEYWORD CONST_KEYWORD VOLATILE_KEYWORD DOUBLE_KEYWORD TOK_BOOL +%token ELLIPSIS RESTRICT TOK_VOID FLOAT_KEYWORD TOK_CHAR WCHAR_T %token ASSIGN_MODIFY @@ -335,16 +335,16 @@ make_name (const char *name, int len) associate greedily. */ %nonassoc NAME -/* Give NEW and DELETE lower precedence than ']', because we can not +/* Give NEW and TOK_DELETE lower precedence than ']', because we can not have an array of type operator new. This causes NEW '[' to be parsed as operator new[]. */ -%nonassoc NEW DELETE +%nonassoc NEW TOK_DELETE -/* Give VOID higher precedence than NAME. Then we can use %prec NAME - to prefer (VOID) to (function_args). */ -%nonassoc VOID +/* Give TOK_VOID higher precedence than NAME. Then we can use %prec NAME + to prefer (TOK_VOID) to (function_args). */ +%nonassoc TOK_VOID -/* Give VOID lower precedence than ')' for similar reasons. */ +/* Give TOK_VOID lower precedence than ')' for similar reasons. */ %nonassoc ')' %left ',' @@ -445,7 +445,7 @@ operator : OPERATOR NEW It would abort on unrecognized string otherwise. */ $$ = make_operator ("new", 3); } - | OPERATOR DELETE + | OPERATOR TOK_DELETE { /* Match the whitespacing of cplus_demangle_operators. It would abort on unrecognized string otherwise. */ @@ -457,7 +457,7 @@ operator : OPERATOR NEW It would abort on unrecognized string otherwise. */ $$ = make_operator ("new[]", 3); } - | OPERATOR DELETE '[' ']' + | OPERATOR TOK_DELETE '[' ']' { /* Match the whitespacing of cplus_demangle_operators. It would abort on unrecognized string otherwise. */ @@ -692,7 +692,7 @@ function_arglist: '(' function_args ')' { $$.comp = fill_comp (DEMANGLE_COMPONENT_FUNCTION_TYPE, NULL, $2.comp); $$.last = &d_left ($$.comp); $$.comp = d_qualify ($$.comp, $4, 1); } - | '(' VOID ')' qualifiers_opt + | '(' TOK_VOID ')' qualifiers_opt { $$.comp = fill_comp (DEMANGLE_COMPONENT_FUNCTION_TYPE, NULL, NULL); $$.last = &d_left ($$.comp); $$.comp = d_qualify ($$.comp, $4, 1); } @@ -730,11 +730,11 @@ int_part : INT_KEYWORD { $$ = INT_SIGNED; } | UNSIGNED { $$ = INT_UNSIGNED; } - | CHAR + | TOK_CHAR { $$ = INT_CHAR; } - | LONG + | TOK_LONG { $$ = INT_LONG; } - | SHORT + | TOK_SHORT { $$ = INT_SHORT; } ; @@ -749,13 +749,13 @@ builtin_type : int_seq { $$ = make_builtin_type ("float"); } | DOUBLE_KEYWORD { $$ = make_builtin_type ("double"); } - | LONG DOUBLE_KEYWORD + | TOK_LONG DOUBLE_KEYWORD { $$ = make_builtin_type ("long double"); } - | BOOL + | TOK_BOOL { $$ = make_builtin_type ("bool"); } | WCHAR_T { $$ = make_builtin_type ("wchar_t"); } - | VOID + | TOK_VOID { $$ = make_builtin_type ("void"); } ; @@ -791,7 +791,7 @@ array_indicator : '[' ']' { $$ = make_empty (DEMANGLE_COMPONENT_ARRAY_TYPE); d_left ($$) = NULL; } - | '[' INT ']' + | '[' TOK_INT ']' { $$ = make_empty (DEMANGLE_COMPONENT_ARRAY_TYPE); d_left ($$) = $2; } @@ -1185,11 +1185,11 @@ exp : exp '?' exp ':' exp %prec '?' } ; -exp : INT +exp : TOK_INT ; /* Not generally allowed. */ -exp : FLOAT +exp : TOK_FLOAT ; exp : SIZEOF '(' type ')' %prec UNARY @@ -1396,12 +1396,12 @@ parse_number (const char *p, int len, in else if (ISDIGIT (c) || c == '.') type = make_builtin_type ("double"); else - return ERROR; + return TOK_ERROR; name = make_name (p, len); yylval.comp = fill_comp (literal_type, type, name); - return FLOAT; + return TOK_FLOAT; } /* This treats 0x1 and 1 as different literals. We also do not @@ -1450,7 +1450,7 @@ parse_number (const char *p, int len, in name = make_name (p, len); yylval.comp = fill_comp (literal_type, type, name); - return INT; + return TOK_INT; } static char backslashable[] = "abefnrtv"; @@ -1608,14 +1608,14 @@ yylex (void) else if (c == '\'') { yyerror (_("empty character constant")); - return ERROR; + return TOK_ERROR; } c = *lexptr++; if (c != '\'') { yyerror (_("invalid character constant")); - return ERROR; + return TOK_ERROR; } /* FIXME: We should refer to a canonical form of the character, @@ -1626,7 +1626,7 @@ yylex (void) make_builtin_type ("char"), make_name (tokstart, lexptr - tokstart)); - return INT; + return TOK_INT; case '(': if (strncmp (tokstart, "(anonymous namespace)", 21) == 0) @@ -1732,14 +1732,14 @@ yylex (void) break; } toktype = parse_number (tokstart, p - tokstart, got_dot|got_e); - if (toktype == ERROR) + if (toktype == TOK_ERROR) { char *err_copy = (char *) alloca (p - tokstart + 1); memcpy (err_copy, tokstart, p - tokstart); err_copy[p - tokstart] = 0; yyerror (_("invalid number")); - return ERROR; + return TOK_ERROR; } lexptr = p; return toktype; @@ -1815,14 +1815,14 @@ yylex (void) case '"': /* These can't occur in C++ names. */ yyerror (_("unexpected string literal")); - return ERROR; + return TOK_ERROR; } if (!(c == '_' || c == '$' || ISALPHA (c))) { /* We must have come across a bad character (e.g. ';'). */ yyerror (_("invalid character")); - return ERROR; + return TOK_ERROR; } /* It's a name. See how long it is. */ @@ -1905,7 +1905,7 @@ yylex (void) HANDLE_SPECIAL ("vtable for ", DEMANGLE_COMPONENT_VTABLE); if (strncmp (tokstart, "delete", 6) == 0) - return DELETE; + return TOK_DELETE; if (strncmp (tokstart, "struct", 6) == 0) return STRUCT; if (strncmp (tokstart, "signed", 6) == 0) @@ -1926,21 +1926,21 @@ yylex (void) if (strncmp (tokstart, "float", 5) == 0) return FLOAT_KEYWORD; if (strncmp (tokstart, "short", 5) == 0) - return SHORT; + return TOK_SHORT; if (strncmp (tokstart, "const", 5) == 0) return CONST_KEYWORD; break; case 4: if (strncmp (tokstart, "void", 4) == 0) - return VOID; + return TOK_VOID; if (strncmp (tokstart, "bool", 4) == 0) - return BOOL; + return TOK_BOOL; if (strncmp (tokstart, "char", 4) == 0) - return CHAR; + return TOK_CHAR; if (strncmp (tokstart, "enum", 4) == 0) return ENUM; if (strncmp (tokstart, "long", 4) == 0) - return LONG; + return TOK_LONG; if (strncmp (tokstart, "true", 4) == 0) return TRUEKEYWORD; break; --- old/orig/gdb/d-exp.y 2014-12-14 02:48:38.000000000 +0100 +++ ./gdb/d-exp.y 2014-12-22 20:32:43.627829285 +0100 @@ -184,7 +184,7 @@ static void push_expression_name (struct %type ArrayLiteral %token ENTRY -%token ERROR +%token TOK_ERROR /* Keywords that have a constant value. */ %token TRUE_KEYWORD FALSE_KEYWORD NULL_KEYWORD @@ -688,7 +688,7 @@ parse_number (struct parser_state *ps, c len = strlen (s); if (! parse_float (s, len, &putithere->typed_val_float.dval, &suffix)) - return ERROR; + return TOK_ERROR; suffix_len = s + len - suffix; @@ -716,7 +716,7 @@ parse_number (struct parser_state *ps, c = parse_d_type (ps)->builtin_idouble; } else - return ERROR; + return TOK_ERROR; } else if (suffix_len == 2) { @@ -732,10 +732,10 @@ parse_number (struct parser_state *ps, c = parse_d_type (ps)->builtin_ireal; } else - return ERROR; + return TOK_ERROR; } else - return ERROR; + return TOK_ERROR; return FLOAT_LITERAL; } @@ -781,7 +781,7 @@ parse_number (struct parser_state *ps, c if (c >= '0' && c <= '9') { if (found_suffix) - return ERROR; + return TOK_ERROR; n += i = c - '0'; } else @@ -789,7 +789,7 @@ parse_number (struct parser_state *ps, c if (base > 10 && c >= 'a' && c <= 'f') { if (found_suffix) - return ERROR; + return TOK_ERROR; n += i = c - 'a' + 10; } else if (c == 'l' && long_p == 0) @@ -803,10 +803,10 @@ parse_number (struct parser_state *ps, c found_suffix = 1; } else - return ERROR; /* Char not a digit */ + return TOK_ERROR; /* Char not a digit */ } if (i >= base) - return ERROR; /* Invalid digit in this base. */ + return TOK_ERROR; /* Invalid digit in this base. */ /* Portably test for integer overflow. */ if (c != 'l' && c != 'u') { @@ -1448,7 +1448,7 @@ yylex (void) toktype = parse_number (pstate, tokstart, p - tokstart, got_dot|got_e, &yylval); - if (toktype == ERROR) + if (toktype == TOK_ERROR) { char *err_copy = (char *) alloca (p - tokstart + 1); --- old/orig/gdb/defs.h 2014-12-14 02:48:38.000000000 +0100 +++ ./gdb/defs.h 2014-12-22 20:39:33.882933928 +0100 @@ -27,6 +27,10 @@ #include "common-defs.h" +// gnulib sys/time.h will include MinGW headers which provide +// alternative binary incompatible definition of struct timeval. +#include + #include #include #include --- gdb-7.8.50.20141222/gdb/f-exp.y-orig 2014-12-22 02:48:39.000000000 +0100 +++ gdb-7.8.50.20141222/gdb/f-exp.y 2014-12-22 22:03:01.005129083 +0100 @@ -175,8 +175,8 @@ static int parse_number (struct parser_s %type func_mod direct_abs_decl abs_decl %type ptype -%token INT -%token FLOAT +%token TOK_INT +%token TOK_FLOAT /* Both NAME and TYPENAME tokens represent symbols in the input, and both convey their data as strings. @@ -201,7 +201,7 @@ static int parse_number (struct parser_s %token NAME_OR_INT %token SIZEOF -%token ERROR +%token TOK_ERROR /* Special type cases, put in to allow the parser to distinguish different legal basetypes. */ @@ -449,7 +449,7 @@ exp : exp ASSIGN_MODIFY exp write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY); } ; -exp : INT +exp : TOK_INT { write_exp_elt_opcode (pstate, OP_LONG); write_exp_elt_type (pstate, $1.type); write_exp_elt_longcst (pstate, (LONGEST) ($1.val)); @@ -467,7 +467,7 @@ exp : NAME_OR_INT write_exp_elt_opcode (pstate, OP_LONG); } ; -exp : FLOAT +exp : TOK_FLOAT { write_exp_elt_opcode (pstate, OP_DOUBLE); write_exp_elt_type (pstate, parse_f_type (pstate) @@ -713,7 +713,7 @@ parse_number (struct parser_state *par_s *tmp2 = 'e'; putithere->dval = atof (tmp); free (tmp); - return FLOAT; + return TOK_FLOAT; } /* Handle base-switching prefixes 0x, 0t, 0d, 0 */ @@ -764,9 +764,9 @@ parse_number (struct parser_state *par_s else if (c >= 'a' && c <= 'f') i = c - 'a' + 10; else - return ERROR; /* Char not a digit */ + return TOK_ERROR; /* Char not a digit */ if (i >= base) - return ERROR; /* Invalid digit in this base */ + return TOK_ERROR; /* Invalid digit in this base */ n *= base; n += i; } @@ -825,7 +825,7 @@ parse_number (struct parser_state *par_s else putithere->typed_val.type = signed_type; - return INT; + return TOK_INT; } struct token @@ -1117,7 +1117,7 @@ yylex (void) toktype = parse_number (pstate, tokstart, p - tokstart, got_dot|got_e|got_d, &yylval); - if (toktype == ERROR) + if (toktype == TOK_ERROR) { char *err_copy = (char *) alloca (p - tokstart + 1); @@ -1244,7 +1244,7 @@ yylex (void) { YYSTYPE newlval; /* Its value is ignored. */ hextype = parse_number (pstate, tokstart, namelen, 0, &newlval); - if (hextype == INT) + if (hextype == TOK_INT) { yylval.ssym.sym = sym; yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL; --- old/orig/gdb/gdbserver/remote-utils.c 2014-12-14 02:48:38.000000000 +0100 +++ ./gdb/gdbserver/remote-utils.c 2014-12-22 20:45:36.881026517 +0100 @@ -727,7 +727,7 @@ static void input_interrupt (int unused) { fd_set readset; - struct timeval immediate = { 0, 0 }; + TIMEVAL immediate = { 0, 0 }; /* Protect against spurious interrupts. This has been observed to be a problem under NetBSD 1.4 and 1.5. */ --- old/orig/gdb/go-exp.y 2014-12-14 02:48:38.000000000 +0100 +++ ./gdb/go-exp.y 2014-12-22 20:33:34.698842311 +0100 @@ -172,8 +172,8 @@ static int parse_go_float (struct gdbarc %type rcurly %type type -%token INT -%token FLOAT +%token TOK_INT +%token TOK_FLOAT /* Both NAME and TYPENAME tokens represent symbols in the input, and both convey their data as strings. @@ -185,7 +185,7 @@ static int parse_go_float (struct gdbarc %token RAW_STRING %token STRING -%token CHAR +%token TOK_CHAR %token NAME %token TYPENAME /* Not TYPE_NAME cus already taken. */ %token COMPLETE @@ -208,7 +208,7 @@ static int parse_go_float (struct gdbarc %token CONST_KEYWORD %token DOTDOTDOT %token ENTRY -%token ERROR +%token TOK_ERROR /* Special type cases. */ %token BYTE_KEYWORD /* An alias of uint8. */ @@ -455,14 +455,14 @@ exp : exp ASSIGN_MODIFY exp write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY); } ; -exp : INT +exp : TOK_INT { write_exp_elt_opcode (pstate, OP_LONG); write_exp_elt_type (pstate, $1.type); write_exp_elt_longcst (pstate, (LONGEST)($1.val)); write_exp_elt_opcode (pstate, OP_LONG); } ; -exp : CHAR +exp : TOK_CHAR { struct stoken_vector vec; vec.len = 1; @@ -484,7 +484,7 @@ exp : NAME_OR_INT ; -exp : FLOAT +exp : TOK_FLOAT { write_exp_elt_opcode (pstate, OP_DOUBLE); write_exp_elt_type (pstate, $1.type); write_exp_elt_dblcst (pstate, $1.dval); @@ -743,8 +743,8 @@ parse_number (struct parser_state *par_s if (! parse_go_float (parse_gdbarch (par_state), p, len, &putithere->typed_val_float.dval, &putithere->typed_val_float.type)) - return ERROR; - return FLOAT; + return TOK_ERROR; + return TOK_FLOAT; } /* Handle base-switching prefixes 0x, 0t, 0d, 0. */ @@ -798,7 +798,7 @@ parse_number (struct parser_state *par_s if (c >= '0' && c <= '9') { if (found_suffix) - return ERROR; + return TOK_ERROR; n += i = c - '0'; } else @@ -806,7 +806,7 @@ parse_number (struct parser_state *par_s if (base > 10 && c >= 'a' && c <= 'f') { if (found_suffix) - return ERROR; + return TOK_ERROR; n += i = c - 'a' + 10; } else if (c == 'l') @@ -820,10 +820,10 @@ parse_number (struct parser_state *par_s found_suffix = 1; } else - return ERROR; /* Char not a digit */ + return TOK_ERROR; /* Char not a digit */ } if (i >= base) - return ERROR; /* Invalid digit in this base. */ + return TOK_ERROR; /* Invalid digit in this base. */ /* Portably test for overflow (only works for nonzero values, so make a second check for zero). FIXME: Can't we just make n and prevn @@ -906,7 +906,7 @@ parse_number (struct parser_state *par_s putithere->typed_val_int.type = signed_type; } - return INT; + return TOK_INT; } /* Temporary obstack used for holding strings. */ @@ -917,7 +917,7 @@ static int tempbuf_init; character may be wide or unicode. *OUTPTR is set to just after the end of the literal in the input string. The resulting token is stored in VALUE. This returns a token value, either STRING or - CHAR, depending on what was parsed. *HOST_CHARS is set to the + TOK_CHAR, depending on what was parsed. *HOST_CHARS is set to the number of host characters in the literal. */ static int @@ -983,7 +983,7 @@ parse_string_or_char (const char *tokptr *outptr = tokptr; - return quote == '\'' ? CHAR : STRING; + return quote == '\'' ? TOK_CHAR : STRING; } struct token @@ -1190,7 +1190,7 @@ lex_one_token (struct parser_state *par_ } toktype = parse_number (par_state, tokstart, p - tokstart, got_dot|got_e, &yylval); - if (toktype == ERROR) + if (toktype == TOK_ERROR) { char *err_copy = (char *) alloca (p - tokstart + 1); @@ -1245,7 +1245,7 @@ lex_one_token (struct parser_state *par_ int host_len; int result = parse_string_or_char (tokstart, &lexptr, &yylval.tsval, &host_len); - if (result == CHAR) + if (result == TOK_CHAR) { if (host_len == 0) error (_("Empty character constant.")); @@ -1515,7 +1515,7 @@ classify_name (struct parser_state *par_ YYSTYPE newlval; /* Its value is ignored. */ int hextype = parse_number (par_state, copy, yylval.sval.length, 0, &newlval); - if (hextype == INT) + if (hextype == TOK_INT) { yylval.ssym.sym = NULL; yylval.ssym.is_a_field_of_this = 0; --- old/orig/gdb/jv-exp.y 2014-12-14 02:48:38.000000000 +0100 +++ ./gdb/jv-exp.y 2014-12-22 20:32:26.083824810 +0100 @@ -183,11 +183,11 @@ static int parse_number (struct parser_s %token NAME_OR_INT -%token ERROR +%token TOK_ERROR /* Special type cases, put in to allow the parser to distinguish different legal basetypes. */ -%token LONG SHORT BYTE INT CHAR BOOLEAN DOUBLE FLOAT +%token TOK_LONG TOK_SHORT TOK_BYTE TOK_INT TOK_CHAR TOK_BOOLEAN TOK_DOUBLE TOK_FLOAT %token VARIABLE @@ -278,7 +278,7 @@ Type: PrimitiveType: NumericType -| BOOLEAN +| TOK_BOOLEAN { $$ = parse_java_type (pstate)->builtin_boolean; } ; @@ -288,22 +288,22 @@ NumericType: ; IntegralType: - BYTE + TOK_BYTE { $$ = parse_java_type (pstate)->builtin_byte; } -| SHORT +| TOK_SHORT { $$ = parse_java_type (pstate)->builtin_short; } -| INT +| TOK_INT { $$ = parse_java_type (pstate)->builtin_int; } -| LONG +| TOK_LONG { $$ = parse_java_type (pstate)->builtin_long; } -| CHAR +| TOK_CHAR { $$ = parse_java_type (pstate)->builtin_char; } ; FloatingPointType: - FLOAT + TOK_FLOAT { $$ = parse_java_type (pstate)->builtin_float; } -| DOUBLE +| TOK_DOUBLE { $$ = parse_java_type (pstate)->builtin_double; } ; @@ -734,7 +734,7 @@ parse_number (struct parser_state *par_s int suffix_len; if (! parse_float (p, len, &putithere->typed_val_float.dval, &suffix)) - return ERROR; + return TOK_ERROR; suffix_len = p + len - suffix; @@ -751,10 +751,10 @@ parse_number (struct parser_state *par_s putithere->typed_val_float.type = parse_type (par_state)->builtin_double; else - return ERROR; + return TOK_ERROR; } else - return ERROR; + return TOK_ERROR; return FLOATING_POINT_LITERAL; } @@ -815,9 +815,9 @@ parse_number (struct parser_state *par_s else if (c >= 'a' && c <= 'z') c -= 'a' - 10; else - return ERROR; /* Char not a digit */ + return TOK_ERROR; /* Char not a digit */ if (c >= base) - return ERROR; + return TOK_ERROR; if (n > limit_div_base || (n *= base) > limit - c) error (_("Numeric constant too large")); @@ -1030,7 +1030,7 @@ yylex (void) } toktype = parse_number (pstate, tokstart, p - tokstart, got_dot|got_e, &yylval); - if (toktype == ERROR) + if (toktype == TOK_ERROR) { char *err_copy = (char *) alloca (p - tokstart + 1); @@ -1159,15 +1159,15 @@ yylex (void) { case 7: if (strncmp (tokstart, "boolean", 7) == 0) - return BOOLEAN; + return TOK_BOOLEAN; break; case 6: if (strncmp (tokstart, "double", 6) == 0) - return DOUBLE; + return TOK_DOUBLE; break; case 5: if (strncmp (tokstart, "short", 5) == 0) - return SHORT; + return TOK_SHORT; if (strncmp (tokstart, "false", 5) == 0) { yylval.lval = 0; @@ -1176,15 +1176,15 @@ yylex (void) if (strncmp (tokstart, "super", 5) == 0) return SUPER; if (strncmp (tokstart, "float", 5) == 0) - return FLOAT; + return TOK_FLOAT; break; case 4: if (strncmp (tokstart, "long", 4) == 0) - return LONG; + return TOK_LONG; if (strncmp (tokstart, "byte", 4) == 0) - return BYTE; + return TOK_BYTE; if (strncmp (tokstart, "char", 4) == 0) - return CHAR; + return TOK_CHAR; if (strncmp (tokstart, "true", 4) == 0) { yylval.lval = 1; @@ -1193,7 +1193,7 @@ yylex (void) break; case 3: if (strncmp (tokstart, "int", 3) == 0) - return INT; + return TOK_INT; if (strncmp (tokstart, "new", 3) == 0) return NEW; break; --- old/orig/gdb/m2-exp.y 2014-12-14 02:48:38.000000000 +0100 +++ ./gdb/m2-exp.y 2014-12-22 20:36:46.442891219 +0100 @@ -156,9 +156,9 @@ static int number_sign = 1; %type block %type fblock -%token INT HEX ERROR -%token UINT M2_TRUE M2_FALSE CHAR -%token FLOAT +%token TOK_INT HEX TOK_ERROR +%token TOK_UINT M2_TRUE M2_FALSE TOK_CHAR +%token TOK_FLOAT /* Both NAME and TYPENAME tokens represent symbols in the input, and both convey their data as strings. @@ -173,7 +173,7 @@ static int number_sign = 1; %token NAME BLOCKNAME IDENT VARNAME %token TYPENAME -%token SIZE CAP ORD HIGH ABS MIN_FUNC MAX_FUNC FLOAT_FUNC VAL CHR ODD TRUNC +%token TOK_SIZE CAP ORD HIGH ABS MIN_FUNC MAX_FUNC FLOAT_FUNC VAL CHR ODD TRUNC %token TSIZE %token INC DEC INCL EXCL @@ -186,7 +186,7 @@ static int number_sign = 1; %left ',' %left ABOVE_COMMA %nonassoc ASSIGN -%left '<' '>' LEQ GEQ '=' NOTEQUAL '#' IN +%left '<' '>' LEQ GEQ '=' NOTEQUAL '#' TOK_IN %left OROR %left LOGICAL_AND '&' %left '@' @@ -293,7 +293,7 @@ exp : TSIZE '(' exp ')' { write_exp_elt_opcode (pstate, UNOP_SIZEOF); } ; -exp : SIZE exp %prec UNARY +exp : TOK_SIZE exp %prec UNARY { write_exp_elt_opcode (pstate, UNOP_SIZEOF); } ; @@ -329,7 +329,7 @@ exp : exp DOT NAME exp : set ; -exp : exp IN set +exp : exp TOK_IN set { error (_("Sets are not implemented."));} ; @@ -499,7 +499,7 @@ exp : M2_FALSE write_exp_elt_opcode (pstate, OP_BOOL); } ; -exp : INT +exp : TOK_INT { write_exp_elt_opcode (pstate, OP_LONG); write_exp_elt_type (pstate, parse_m2_type (pstate)->builtin_int); @@ -507,7 +507,7 @@ exp : INT write_exp_elt_opcode (pstate, OP_LONG); } ; -exp : UINT +exp : TOK_UINT { write_exp_elt_opcode (pstate, OP_LONG); write_exp_elt_type (pstate, @@ -518,7 +518,7 @@ exp : UINT } ; -exp : CHAR +exp : TOK_CHAR { write_exp_elt_opcode (pstate, OP_LONG); write_exp_elt_type (pstate, parse_m2_type (pstate) @@ -528,7 +528,7 @@ exp : CHAR ; -exp : FLOAT +exp : TOK_FLOAT { write_exp_elt_opcode (pstate, OP_DOUBLE); write_exp_elt_type (pstate, parse_m2_type (pstate) @@ -540,7 +540,7 @@ exp : FLOAT exp : variable ; -exp : SIZE '(' type ')' %prec UNARY +exp : TOK_SIZE '(' type ')' %prec UNARY { write_exp_elt_opcode (pstate, OP_LONG); write_exp_elt_type (pstate, parse_type (pstate)->builtin_int); @@ -709,7 +709,7 @@ parse_number (int olen) /* It's a float since it contains a point. */ yylval.dval = atof (p); lexptr += len; - return FLOAT; + return TOK_FLOAT; } if (p[c] == '.' && base != 10) error (_("Floating point numbers must be base 10.")); @@ -730,11 +730,11 @@ parse_number (int olen) if (base == 16 && c >= 'A' && c <= 'F') i = c - 'A' + 10; else - return ERROR; + return TOK_ERROR; } n+=i; if(i >= base) - return ERROR; + return TOK_ERROR; if(!unsigned_p && number_sign == 1 && (prevn >= n)) unsigned_p=1; /* Try something unsigned */ /* Don't do the range check if n==i and i==0, since that special @@ -755,19 +755,19 @@ parse_number (int olen) if (ischar) { yylval.ulval = n; - return CHAR; + return TOK_CHAR; } else if ( unsigned_p && number_sign == 1) { yylval.ulval = n; - return UINT; + return TOK_UINT; } else if((unsigned_p && (n<0))) { range_error (_("Overflow on numeric constant -- number too large.")); /* But, this can return if range_check == range_warn. */ } yylval.lval = n; - return INT; + return TOK_INT; } @@ -797,7 +797,7 @@ struct keyword { static struct keyword keytab[] = { {"OR" , OROR }, - {"IN", IN },/* Note space after IN */ + {"IN", TOK_IN },/* Note space after TOK_IN */ {"AND", LOGICAL_AND}, {"ABS", ABS }, {"CHR", CHR }, @@ -815,10 +815,10 @@ static struct keyword keytab[] = {"EXCL", EXCL }, {"HIGH", HIGH }, {"INCL", INCL }, - {"SIZE", SIZE }, + {"SIZE", TOK_SIZE }, {"FLOAT", FLOAT_FUNC }, {"TRUNC", TRUNC }, - {"TSIZE", SIZE }, + {"TSIZE", TOK_SIZE }, }; @@ -933,7 +933,7 @@ yylex (void) if(namelen == 2) /* Single character */ { yylval.ulval = tokstart[1]; - return CHAR; + return TOK_CHAR; } else return STRING; @@ -966,7 +966,7 @@ yylex (void) break; } toktype = parse_number (p - tokstart); - if (toktype == ERROR) + if (toktype == TOK_ERROR) { char *err_copy = (char *) alloca (p - tokstart + 1); --- old/orig/gdb/p-exp.y 2014-12-14 02:48:38.000000000 +0100 +++ ./gdb/p-exp.y 2014-12-22 20:35:33.514872617 +0100 @@ -181,8 +181,8 @@ static int search_field; /* Fancy type parsing. */ %type ptype -%token INT -%token FLOAT +%token TOK_INT +%token TOK_FLOAT /* Both NAME and TYPENAME tokens represent symbols in the input, and both convey their data as strings. @@ -208,7 +208,7 @@ static int search_field; %token NAME_OR_INT %token STRUCT CLASS SIZEOF COLONCOLON -%token ERROR +%token TOK_ERROR /* Special type cases, put in to allow the parser to distinguish different legal basetypes. */ @@ -217,7 +217,7 @@ static int search_field; /* Object pascal */ -%token THIS +%token TOK_THIS %token TRUEKEYWORD FALSEKEYWORD %left ',' @@ -543,7 +543,7 @@ exp : FALSEKEYWORD write_exp_elt_opcode (pstate, OP_BOOL); } ; -exp : INT +exp : TOK_INT { write_exp_elt_opcode (pstate, OP_LONG); write_exp_elt_type (pstate, $1.type); current_type = $1.type; @@ -565,7 +565,7 @@ exp : NAME_OR_INT ; -exp : FLOAT +exp : TOK_FLOAT { write_exp_elt_opcode (pstate, OP_DOUBLE); write_exp_elt_type (pstate, $1.type); current_type = $1.type; @@ -638,7 +638,7 @@ exp : STRING ; /* Object pascal */ -exp : THIS +exp : TOK_THIS { struct value * this_val; struct type * this_type; @@ -913,8 +913,8 @@ parse_number (struct parser_state *par_s if (! parse_c_float (parse_gdbarch (par_state), p, len, &putithere->typed_val_float.dval, &putithere->typed_val_float.type)) - return ERROR; - return FLOAT; + return TOK_ERROR; + return TOK_FLOAT; } /* Handle base-switching prefixes 0x, 0t, 0d, 0. */ @@ -958,7 +958,7 @@ parse_number (struct parser_state *par_s if (c >= '0' && c <= '9') { if (found_suffix) - return ERROR; + return TOK_ERROR; n += i = c - '0'; } else @@ -966,7 +966,7 @@ parse_number (struct parser_state *par_s if (base > 10 && c >= 'a' && c <= 'f') { if (found_suffix) - return ERROR; + return TOK_ERROR; n += i = c - 'a' + 10; } else if (c == 'l') @@ -980,10 +980,10 @@ parse_number (struct parser_state *par_s found_suffix = 1; } else - return ERROR; /* Char not a digit */ + return TOK_ERROR; /* Char not a digit */ } if (i >= base) - return ERROR; /* Invalid digit in this base. */ + return TOK_ERROR; /* Invalid digit in this base. */ /* Portably test for overflow (only works for nonzero values, so make a second check for zero). FIXME: Can't we just make n and prevn @@ -1066,7 +1066,7 @@ parse_number (struct parser_state *par_s putithere->typed_val_int.type = signed_type; } - return INT; + return TOK_INT; } @@ -1240,7 +1240,7 @@ yylex (void) } error (_("Invalid character constant.")); } - return INT; + return TOK_INT; case '(': paren_depth++; @@ -1322,7 +1322,7 @@ yylex (void) } toktype = parse_number (pstate, tokstart, p - tokstart, got_dot | got_e, &yylval); - if (toktype == ERROR) + if (toktype == TOK_ERROR) { char *err_copy = (char *) alloca (p - tokstart + 1); @@ -1511,7 +1511,7 @@ yylex (void) VAR_DOMAIN, NULL)) { free (uptokstart); - return THIS; + return TOK_THIS; } } break; @@ -1727,7 +1727,7 @@ yylex (void) { YYSTYPE newlval; /* Its value is ignored. */ hextype = parse_number (pstate, tokstart, namelen, 0, &newlval); - if (hextype == INT) + if (hextype == TOK_INT) { yylval.ssym.sym = sym; yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL; --- old/orig/gdb/ser-tcp.c 2014-12-14 02:48:39.000000000 +0100 +++ ./gdb/ser-tcp.c 2014-12-22 19:27:27.393845431 +0100 @@ -42,6 +42,8 @@ #ifndef ETIMEDOUT #define ETIMEDOUT WSAETIMEDOUT #endif +/* gnulib/ may define 'close'. */ +#undef close #define close(fd) closesocket (fd) #define ioctl ioctlsocket #else @@ -120,11 +122,15 @@ wait_for_connect (struct serial *scb, un if (scb) { fd_set rset, wset, eset; + TIMEVAL t_mingw; FD_ZERO (&rset); FD_SET (scb->fd, &rset); wset = rset; eset = rset; + + t_mingw.tv_sec = t.tv_sec; + t_mingw.tv_usec = t.tv_usec; /* POSIX systems return connection success or failure by signalling wset. Windows systems return success in wset and failure in @@ -134,7 +140,7 @@ wait_for_connect (struct serial *scb, un the serial structure has not yet been initialized - the MinGW select wrapper will not know that this FD refers to a socket. */ - n = select (scb->fd + 1, &rset, &wset, &eset, &t); + n = select (scb->fd + 1, &rset, &wset, &eset, &t_mingw); } else /* Use gdb_select here, since we have no file descriptors, and on --- old/orig/gdb/symfile.c 2014-12-14 02:48:39.000000000 +0100 +++ ./gdb/symfile.c 2014-12-22 20:36:24.115885524 +0100 @@ -3541,12 +3541,12 @@ overlay_command (char *args, int from_tt In this simple implementation, the target data structures are as follows: unsigned _novlys; /# number of overlay sections #/ unsigned _ovly_table[_novlys][4] = { - {VMA, SIZE, LMA, MAPPED}, /# one entry per overlay section #/ + {VMA, OVLY_SIZE, LMA, MAPPED}, /# one entry per overlay section #/ {..., ..., ..., ...}, } unsigned _novly_regions; /# number of overlay regions #/ unsigned _ovly_region_table[_novly_regions][3] = { - {VMA, SIZE, MAPPED_TO_LMA}, /# one entry per overlay region #/ + {VMA, OVLY_SIZE, MAPPED_TO_LMA}, /# one entry per overlay region #/ {..., ..., ...}, } These functions will attempt to update GDB's mappedness state in the @@ -3564,7 +3564,7 @@ static unsigned cache_novlys = 0; static CORE_ADDR cache_ovly_table_base = 0; enum ovly_index { - VMA, SIZE, LMA, MAPPED + VMA, OVLY_SIZE, LMA, MAPPED }; /* Throw away the cached copy of _ovly_table. */ @@ -3664,14 +3664,14 @@ simple_overlay_update_1 (struct obj_sect for (i = 0; i < cache_novlys; i++) if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect) && cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect) - /* && cache_ovly_table[i][SIZE] == size */ ) + /* && cache_ovly_table[i][OVLY_SIZE] == size */ ) { read_target_long_array (cache_ovly_table_base + i * word_size, (unsigned int *) cache_ovly_table[i], 4, word_size, byte_order); if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect) && cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect) - /* && cache_ovly_table[i][SIZE] == size */ ) + /* && cache_ovly_table[i][OVLY_SIZE] == size */ ) { osect->ovly_mapped = cache_ovly_table[i][MAPPED]; return 1; @@ -3737,7 +3737,7 @@ simple_overlay_update (struct obj_sectio for (i = 0; i < cache_novlys; i++) if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect) && cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect) - /* && cache_ovly_table[i][SIZE] == size */ ) + /* && cache_ovly_table[i][OVLY_SIZE] == size */ ) { /* obj_section matches i'th entry in ovly_table. */ osect->ovly_mapped = cache_ovly_table[i][MAPPED]; break; /* finished with inner for loop: break out. */ --- old/orig/include/coff/ecoff.h 2014-12-14 02:48:39.000000000 +0100 +++ ./include/coff/ecoff.h 2014-12-22 20:01:14.471204731 +0100 @@ -148,10 +148,12 @@ /* gcc also uses mips-tfile to output COFF debugging information. These are the values it uses when outputting the .type directive. These should also be in a shared include file. */ +#ifndef _WIN64 #define N_BTMASK (017) #define N_TMASK (060) #define N_BTSHFT (4) #define N_TSHIFT (2) +#endif /********************** AUX **********************/ --- old/orig/include/coff/internal.h 2014-12-14 02:48:39.000000000 +0100 +++ ./include/coff/internal.h 2014-12-22 20:01:48.439246332 +0100 @@ -21,6 +21,10 @@ #ifndef GNU_COFF_INTERNAL_H #define GNU_COFF_INTERNAL_H 1 +#ifdef _WIN64 +# include +#endif + /* First, make "signed char" work, even on old compilers. */ #ifndef signed #ifndef __STDC__ @@ -109,11 +113,13 @@ struct internal_filehdr #define F_GO32STUB (0x4000) /* Extra structure which is used in the optional header. */ +#ifndef _WIN64 typedef struct _IMAGE_DATA_DIRECTORY { bfd_vma VirtualAddress; long Size; } IMAGE_DATA_DIRECTORY; +#endif #define PE_EXPORT_TABLE 0 #define PE_IMPORT_TABLE 1 #define PE_RESOURCE_TABLE 2 @@ -533,6 +539,7 @@ struct internal_syment #define BTYPE(x) ((x) & N_BTMASK) #define DTYPE(x) (((x) & N_TMASK) >> N_BTSHFT) +#ifndef _WIN64 #define ISPTR(x) \ (((unsigned long) (x) & N_TMASK) == ((unsigned long) DT_PTR << N_BTSHFT)) #define ISFCN(x) \ @@ -543,6 +550,7 @@ struct internal_syment ((x) == C_STRTAG || (x) == C_UNTAG || (x) == C_ENTAG) #define DECREF(x) \ ((((x) >> N_TSHIFT) & ~ N_BTMASK) | ((x) & N_BTMASK)) +#endif union internal_auxent { --- old/orig/include/coff/pe.h 2014-12-14 02:48:39.000000000 +0100 +++ ./include/coff/pe.h 2014-12-22 20:11:01.742540716 +0100 @@ -86,6 +90,7 @@ #define IMAGE_SCN_ALIGN_POWER_CONST(val) \ (((val) + 1) << IMAGE_SCN_ALIGN_POWER_BIT_POS) +#ifndef _WIN64 #define IMAGE_SCN_ALIGN_1BYTES IMAGE_SCN_ALIGN_POWER_CONST (0) #define IMAGE_SCN_ALIGN_2BYTES IMAGE_SCN_ALIGN_POWER_CONST (1) #define IMAGE_SCN_ALIGN_4BYTES IMAGE_SCN_ALIGN_POWER_CONST (2) @@ -101,6 +106,7 @@ #define IMAGE_SCN_ALIGN_2048BYTES IMAGE_SCN_ALIGN_POWER_CONST (11) #define IMAGE_SCN_ALIGN_4096BYTES IMAGE_SCN_ALIGN_POWER_CONST (12) #define IMAGE_SCN_ALIGN_8192BYTES IMAGE_SCN_ALIGN_POWER_CONST (13) +#endif /* Encode alignment power into IMAGE_SCN_ALIGN bits of s_flags. */ #define COFF_ENCODE_ALIGNMENT(SECTION, ALIGNMENT_POWER) \ @@ -113,14 +119,17 @@ /* COMDAT selection codes. */ +#ifndef _WIN64 #define IMAGE_COMDAT_SELECT_NODUPLICATES (1) /* Warn if duplicates. */ #define IMAGE_COMDAT_SELECT_ANY (2) /* No warning. */ #define IMAGE_COMDAT_SELECT_SAME_SIZE (3) /* Warn if different size. */ #define IMAGE_COMDAT_SELECT_EXACT_MATCH (4) /* Warn if different. */ #define IMAGE_COMDAT_SELECT_ASSOCIATIVE (5) /* Base on other section. */ +#endif /* Machine numbers. */ +#ifndef _WIN64 #define IMAGE_FILE_MACHINE_UNKNOWN 0x0000 #define IMAGE_FILE_MACHINE_ALPHA 0x0184 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284 @@ -134,7 +143,9 @@ #define IMAGE_FILE_MACHINE_I386 0x014c #define IMAGE_FILE_MACHINE_IA64 0x0200 #define IMAGE_FILE_MACHINE_M32R 0x9041 +#endif #define IMAGE_FILE_MACHINE_M68K 0x0268 +#ifndef _WIN64 #define IMAGE_FILE_MACHINE_MIPS16 0x0266 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466 @@ -152,6 +163,7 @@ #define IMAGE_FILE_MACHINE_TRICORE 0x0520 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169 #define IMAGE_FILE_MACHINE_AMD64 0x8664 +#endif #define IMAGE_SUBSYSTEM_UNKNOWN 0 #define IMAGE_SUBSYSTEM_NATIVE 1 @@ -501,11 +513,15 @@ struct external_pex64_unwind_code #define PEX64_UNWCODE_INFO(VAL) (((VAL) >> 4) & 0xf) /* The unwind info. */ +#ifndef _WIN64 #define UNW_FLAG_NHANDLER 0 #define UNW_FLAG_EHANDLER 1 #define UNW_FLAG_UHANDLER 2 +#endif #define UNW_FLAG_FHANDLER 3 +#ifndef _WIN64 #define UNW_FLAG_CHAININFO 4 +#endif #define UNW_FLAG_MASK 0x1f