Changeset 609 for branches/GNU/src/binutils/gas/read.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/gas/read.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* read.c - read a source file - 2 2 Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000 Free Software Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. 4 4 5 5 This file is part of GAS, the GNU Assembler. … … 36 36 Another group of these functions is in the expr.c module. */ 37 37 38 /* For isdigit (). */39 #include <ctype.h>40 41 38 #include "as.h" 39 #include "safe-ctype.h" 42 40 #include "subsegs.h" 43 41 #include "sb.h" … … 48 46 49 47 #ifndef TC_START_LABEL 50 #define TC_START_LABEL(x,y) (x ==':')48 #define TC_START_LABEL(x,y) (x == ':') 51 49 #endif 52 50 … … 170 168 internals manual. */ 171 169 int target_big_endian = TARGET_BYTES_BIG_ENDIAN; 172 173 static char *old_buffer; /* JF a hack. */174 static char *old_input;175 static char *old_limit;176 170 177 171 /* Variables for handling include file directory table. */ … … 320 314 {"endfunc", s_func, 1}, 321 315 {"endif", s_endif, 0}, 316 {"endr", s_bad_endr, 0}, 322 317 /* endef */ 323 318 {"equ", s_set, 0}, … … 352 347 {"ifnes", s_ifeqs, 1}, 353 348 {"ifnotdef", s_ifdef, 1}, 349 {"incbin", s_incbin, 0}, 354 350 {"include", s_include, 0}, 355 351 {"int", cons, 4}, … … 537 533 { /* We have another line to parse. */ 538 534 know (buffer_limit[-1] == '\n'); /* Must have a sentinel. */ 539 contin: /* JF this goto is my fault I admit it. 540 Someone brave please re-write the whole 541 input section here? Pleeze??? */ 535 542 536 while (input_line_pointer < buffer_limit) 543 537 { … … 742 736 while (*s2) 743 737 { 744 if (isupper ((unsigned char) *s2)) 745 *s2 = tolower (*s2); 738 *s2 = TOLOWER (*s2); 746 739 s2++; 747 740 } … … 803 796 if (pop == NULL) 804 797 { 805 as_bad (_(" Unknown pseudo-op:`%s'"), s);798 as_bad (_("unknown pseudo-op: `%s'"), s); 806 799 *input_line_pointer = c; 807 800 s_ignore (0); … … 867 860 macro_entry *macro; 868 861 869 if (check_macro (s, &out, '\0',&err, ¯o))862 if (check_macro (s, &out, &err, ¯o)) 870 863 { 871 864 if (err != NULL) … … 910 903 continue; 911 904 912 if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB) 913 && isdigit ((unsigned char) c)) 905 if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB) && ISDIGIT (c)) 914 906 { 915 907 /* local label ("4:") */ … … 921 913 922 914 /* Read the whole number. */ 923 while ( isdigit ((unsigned char)*input_line_pointer))915 while (ISDIGIT (*input_line_pointer)) 924 916 { 925 917 temp = (temp * 10) + *input_line_pointer - '0'; … … 956 948 if (c && strchr (line_comment_chars, c)) 957 949 { /* Its a comment. Better say APP or NO_APP. */ 950 sb sbuf; 958 951 char *ends; 959 952 char *new_buf; … … 968 961 s += 4; 969 962 963 sb_new (&sbuf); 970 964 ends = strstr (s, "#NO_APP\n"); 971 965 … … 1029 1023 if (size < space) 1030 1024 { 1031 new_tmp += size;1025 new_tmp[size] = 0; 1032 1026 break; 1033 1027 } … … 1040 1034 if (tmp_buf) 1041 1035 free (tmp_buf); 1042 old_buffer = buffer; 1043 old_input = input_line_pointer; 1044 old_limit = buffer_limit; 1045 buffer = new_buf; 1046 input_line_pointer = new_buf; 1047 buffer_limit = new_tmp; 1048 1036 1037 /* We've "scrubbed" input to the preferred format. In the 1038 process we may have consumed the whole of the remaining 1039 file (and included files). We handle this formatted 1040 input similar to that of macro expansion, letting 1041 actual macro expansion (possibly nested) and other 1042 input expansion work. Beware that in messages, line 1043 numbers and possibly file names will be incorrect. */ 1044 sb_add_string (&sbuf, new_buf); 1045 input_scrub_include_sb (&sbuf, input_line_pointer, 0); 1046 sb_kill (&sbuf); 1047 buffer_limit = input_scrub_next_buffer (&input_line_pointer); 1048 free (new_buf); 1049 1049 continue; 1050 1050 } … … 1056 1056 continue; 1057 1057 #endif 1058 /* as_warn (_("Junk character %d."),c); Now done by ignore_rest. */1059 input_line_pointer--;/* Report unknown char as ignored. */1058 input_line_pointer--; 1059 /* Report unknown char as ignored. */ 1060 1060 ignore_rest_of_line (); 1061 1061 } … … 1064 1064 md_after_pass_hook (); 1065 1065 #endif 1066 1067 if (old_buffer)1068 {1069 free (buffer);1070 bump_line_counters ();1071 if (old_input != 0)1072 {1073 buffer = old_buffer;1074 input_line_pointer = old_input;1075 buffer_limit = old_limit;1076 old_buffer = 0;1077 goto contin;1078 }1079 }1080 1066 } 1081 1067 … … 1169 1155 int max; 1170 1156 { 1157 if (now_seg == absolute_section) 1158 { 1159 if (fill != NULL) 1160 while (len-- > 0) 1161 if (*fill++ != '\0') 1162 { 1163 as_warn (_("ignoring fill value in absolute section")); 1164 break; 1165 } 1166 fill = NULL; 1167 len = 0; 1168 } 1169 1171 1170 #ifdef md_do_align 1172 1171 md_do_align (n, fill, len, max, just_record_alignment); … … 1190 1189 1191 1190 #ifdef md_do_align 1192 just_record_alignment: 1191 just_record_alignment: ATTRIBUTE_UNUSED_LABEL 1193 1192 #endif 1194 1193 … … 1239 1238 ; 1240 1239 if (align != 1) 1241 as_bad (_(" Alignment not a power of 2"));1240 as_bad (_("alignment not a power of 2")); 1242 1241 1243 1242 align = i; … … 1248 1247 { 1249 1248 align = 15; 1250 as_ bad (_("Alignment too large: %u assumed"), align);1249 as_warn (_("alignment too large: %u assumed"), align); 1251 1250 } 1252 1251 … … 1355 1354 p = input_line_pointer; 1356 1355 *p = c; 1356 1357 if (name == p) 1358 { 1359 as_bad (_("expected symbol name")); 1360 discard_rest_of_line (); 1361 return; 1362 } 1363 1357 1364 SKIP_WHITESPACE (); 1358 1365 1359 1366 if (*input_line_pointer != ',') 1360 1367 { 1361 as_bad (_("Expected comma after symbol-name: rest of line ignored.")); 1368 *p = 0; 1369 as_bad (_("expected comma after \"%s\""), name); 1370 *p = c; 1362 1371 ignore_rest_of_line (); 1363 1372 if (flag_mri) … … 1370 1379 if ((temp = get_absolute_expression ()) < 0) 1371 1380 { 1372 as_warn (_(".COMMon length (%ld .) <0! Ignored."), (long) temp);1381 as_warn (_(".COMMon length (%ld) < 0 ignored"), (long) temp); 1373 1382 ignore_rest_of_line (); 1374 1383 if (flag_mri) … … 1383 1392 if (S_IS_DEFINED (symbolP) && !S_IS_COMMON (symbolP)) 1384 1393 { 1385 as_bad (_(" Ignoring attempt to re-define symbol `%s'."),1394 as_bad (_("symbol `%s' is already defined"), 1386 1395 S_GET_NAME (symbolP)); 1387 1396 ignore_rest_of_line (); … … 1394 1403 { 1395 1404 if (S_GET_VALUE (symbolP) != (valueT) temp) 1396 as_bad (_(" Length of .comm \"%s\" is already %ld. Not changed to %ld."),1405 as_bad (_("length of .comm \"%s\" is already %ld; not changing to %ld"), 1397 1406 S_GET_NAME (symbolP), 1398 1407 (long) S_GET_VALUE (symbolP), … … 1446 1455 1447 1456 name = input_line_pointer; 1448 if (! isdigit ((unsigned char)*name))1457 if (!ISDIGIT (*name)) 1449 1458 c = get_symbol_end (); 1450 1459 else … … 1454 1463 ++input_line_pointer; 1455 1464 } 1456 while ( isdigit ((unsigned char)*input_line_pointer));1465 while (ISDIGIT (*input_line_pointer)); 1457 1466 1458 1467 c = *input_line_pointer; … … 1484 1493 if (S_IS_DEFINED (sym) && !S_IS_COMMON (sym)) 1485 1494 { 1486 as_bad (_(" attempt to re-define symbol `%s'"), S_GET_NAME (sym));1495 as_bad (_("symbol `%s' is already defined"), S_GET_NAME (sym)); 1487 1496 ignore_rest_of_line (); 1488 1497 mri_comment_end (stop, stopc); … … 1555 1564 1556 1565 void 1566 s_app_file_string (file) 1567 char *file; 1568 { 1569 #ifdef LISTING 1570 if (listing) 1571 listing_source_file (file); 1572 #endif 1573 register_dependency (file); 1574 #ifdef obj_app_file 1575 obj_app_file (file); 1576 #endif 1577 } 1578 1579 void 1557 1580 s_app_file (appfile) 1558 1581 int appfile; … … 1579 1602 demand_empty_rest_of_line (); 1580 1603 if (!may_omit) 1581 { 1582 #ifdef LISTING 1583 if (listing) 1584 listing_source_file (s); 1585 #endif 1586 register_dependency (s); 1587 #ifdef obj_app_file 1588 obj_app_file (s); 1589 #endif 1590 } 1604 s_app_file_string (s); 1591 1605 } 1592 1606 } … … 1608 1622 /* Some of the back ends can't deal with non-positive line numbers. 1609 1623 Besides, it's silly. */ 1610 as_warn (_(" Line numbers must be positive; line number %d rejected."),1624 as_warn (_("line numbers must be positive; line number %d rejected"), 1611 1625 l + 1); 1612 1626 else … … 1704 1718 if (size > BSD_FILL_SIZE_CROCK_8) 1705 1719 { 1706 as_warn (_(".fill size clamped to %d ."), BSD_FILL_SIZE_CROCK_8);1720 as_warn (_(".fill size clamped to %d"), BSD_FILL_SIZE_CROCK_8); 1707 1721 size = BSD_FILL_SIZE_CROCK_8; 1708 1722 } 1709 1723 if (size < 0) 1710 1724 { 1711 as_warn (_(" Size negative: .fill ignored."));1725 as_warn (_("size negative; .fill ignored")); 1712 1726 size = 0; 1713 1727 } … … 1715 1729 { 1716 1730 if (rep_exp.X_add_number < 0) 1717 as_warn (_(" Repeat < 0,.fill ignored"));1731 as_warn (_("repeat < 0; .fill ignored")); 1718 1732 size = 0; 1719 1733 } … … 1757 1771 1758 1772 /* The magic number BSD_FILL_SIZE_CROCK_4 is from BSD 4.2 VAX 1759 flavoured AS. The following biz zare behaviour is to be1773 flavoured AS. The following bizarre behaviour is to be 1760 1774 compatible with above. I guess they tried to take up to 8 1761 1775 bytes from a 4-byte expression and they forgot to sign 1762 extend. Un*x Sux.*/1776 extend. */ 1763 1777 #define BSD_FILL_SIZE_CROCK_4 (4) 1764 1778 md_number_to_chars (p, (valueT) fill, … … 1801 1815 input_line_pointer++; 1802 1816 SKIP_WHITESPACE (); 1803 if ( *input_line_pointer == '\n')1817 if (is_end_of_line[(unsigned char) *input_line_pointer]) 1804 1818 c = '\n'; 1805 1819 } … … 1833 1847 sb_new (&out); 1834 1848 1835 err = expand_irp (irpc, 0, &s, &out, get_line_sb , '\0');1849 err = expand_irp (irpc, 0, &s, &out, get_line_sb); 1836 1850 if (err != NULL) 1837 1851 as_bad_where (file, line, "%s", err); … … 1945 1959 p = input_line_pointer; 1946 1960 *p = c; 1961 1962 if (name == p) 1963 { 1964 as_bad (_("expected symbol name")); 1965 discard_rest_of_line (); 1966 return; 1967 } 1968 1947 1969 SKIP_WHITESPACE (); 1948 1970 … … 1955 1977 } 1956 1978 1957 if ( *input_line_pointer == '\n')1958 { 1959 as_bad (_(" Missing size expression"));1979 if (is_end_of_line[(unsigned char) *input_line_pointer]) 1980 { 1981 as_bad (_("missing size expression")); 1960 1982 return; 1961 1983 } … … 1963 1985 if ((temp = get_absolute_expression ()) < 0) 1964 1986 { 1965 as_warn (_("BSS length (%d .) <0! Ignored."), temp);1987 as_warn (_("BSS length (%d) < 0 ignored"), temp); 1966 1988 ignore_rest_of_line (); 1967 1989 return; … … 1973 1995 { 1974 1996 /* For MIPS and Alpha ECOFF or ELF, small objects are put in .sbss. */ 1975 if ( temp <= bfd_get_gp_size (stdoutput))1997 if ((unsigned) temp <= bfd_get_gp_size (stdoutput)) 1976 1998 { 1977 1999 bss_seg = subseg_new (".sbss", 1); … … 2002 2024 if (*input_line_pointer != ',') 2003 2025 { 2004 as_bad (_(" Expected comma after size"));2026 as_bad (_("expected comma after size")); 2005 2027 ignore_rest_of_line (); 2006 2028 return; … … 2010 2032 SKIP_WHITESPACE (); 2011 2033 2012 if ( *input_line_pointer == '\n')2013 { 2014 as_bad (_(" Missing alignment"));2034 if (is_end_of_line[(unsigned char) *input_line_pointer]) 2035 { 2036 as_bad (_("missing alignment")); 2015 2037 return; 2016 2038 } … … 2028 2050 ; 2029 2051 if (align != 1) 2030 as_bad (_(" Alignment not a power of 2"));2052 as_bad (_("alignment not a power of 2")); 2031 2053 align = i; 2032 2054 } … … 2036 2058 { 2037 2059 align = max_alignment; 2038 as_warn (_(" Alignment too large: %d. assumed."), align);2060 as_warn (_("alignment too large; %d assumed"), align); 2039 2061 } 2040 2062 else if (align < 0) 2041 2063 { 2042 2064 align = 0; 2043 as_warn (_(" Alignment negative. 0 assumed."));2065 as_warn (_("alignment negative; 0 assumed")); 2044 2066 } 2045 2067 … … 2109 2131 } 2110 2132 else 2111 as_bad (_("Ignoring attempt to re-define symbol `%s'."), 2112 S_GET_NAME (symbolP)); 2133 as_bad (_("symbol `%s' is already defined"), S_GET_NAME (symbolP)); 2113 2134 2114 2135 subseg_set (current_seg, current_subseg); … … 2146 2167 p = input_line_pointer; 2147 2168 *p = c; 2169 2170 if (name == p) 2171 { 2172 as_bad (_("expected symbol name")); 2173 discard_rest_of_line (); 2174 return; 2175 } 2176 2148 2177 SKIP_WHITESPACE (); 2149 2178 … … 2151 2180 { 2152 2181 *p = 0; 2153 as_bad (_(" Expected comma after name\"%s\""), name);2182 as_bad (_("expected comma after \"%s\""), name); 2154 2183 *p = c; 2155 2184 ignore_rest_of_line (); … … 2191 2220 else 2192 2221 { 2193 as_bad (_(" Symbol %s already defined"), name);2222 as_bad (_("symbol `%s' is already defined"), name); 2194 2223 } 2195 2224 … … 2198 2227 } 2199 2228 2200 /* Read a line into an sb. */ 2229 /* Read a line into an sb. Returns the character that ended the line 2230 or zero if there are no more lines. */ 2201 2231 2202 2232 static int … … 2205 2235 { 2206 2236 char quote1, quote2, inquote; 2237 unsigned char c; 2207 2238 2208 2239 if (input_line_pointer[-1] == '\n') … … 2232 2263 inquote = '\0'; 2233 2264 2234 while (!is_end_of_line[(unsigned char) *input_line_pointer] 2235 || (inquote != '\0' && *input_line_pointer != '\n')) 2236 { 2237 if (inquote == *input_line_pointer) 2265 while ((c = * input_line_pointer ++) != 0 2266 && (!is_end_of_line[c] 2267 || (inquote != '\0' && c != '\n'))) 2268 { 2269 if (inquote == c) 2238 2270 inquote = '\0'; 2239 2271 else if (inquote == '\0') 2240 2272 { 2241 if ( *input_line_pointer== quote1)2273 if (c == quote1) 2242 2274 inquote = quote1; 2243 else if ( *input_line_pointer== quote2)2275 else if (c == quote2) 2244 2276 inquote = quote2; 2245 2277 } 2246 2278 2247 sb_add_char (line, *input_line_pointer++); 2248 } 2249 2250 while (input_line_pointer < buffer_limit 2251 && is_end_of_line[(unsigned char) *input_line_pointer]) 2252 { 2253 if (input_line_pointer[-1] == '\n') 2254 bump_line_counters (); 2255 ++input_line_pointer; 2256 } 2257 2258 return 1; 2259 } 2260 2261 /* Define a macro. This is an interface to macro.c, which is shared 2262 between gas and gasp. */ 2279 sb_add_char (line, c); 2280 } 2281 2282 /* Don't skip multiple end-of-line characters, because that breaks support 2283 for the IA-64 stop bit (;;) which looks like two consecutive end-of-line 2284 characters but isn't. Instead just skip one end of line character and 2285 return the character skipped so that the caller can re-insert it if 2286 necessary. */ 2287 return c; 2288 } 2289 2290 /* Define a macro. This is an interface to macro.c. */ 2263 2291 2264 2292 void … … 2366 2394 { 2367 2395 if (segment != now_seg && segment != absolute_section) 2368 as_bad (_("invalid segment \"%s\"; segment \"%s\" assumed"), 2369 segment_name (segment), segment_name (now_seg)); 2396 as_bad (_("invalid segment \"%s\""), segment_name (segment)); 2370 2397 2371 2398 if (now_seg == absolute_section) … … 2467 2494 2468 2495 name = input_line_pointer; 2469 if (! isdigit ((unsigned char)*name))2496 if (!ISDIGIT (*name)) 2470 2497 c = get_symbol_end (); 2471 2498 else … … 2475 2502 ++input_line_pointer; 2476 2503 } 2477 while ( isdigit ((unsigned char)*input_line_pointer));2504 while (ISDIGIT (*input_line_pointer)); 2478 2505 2479 2506 c = *input_line_pointer; … … 2500 2527 { 2501 2528 c = *++input_line_pointer; 2502 c = toupper ((unsigned char)c);2529 c = TOUPPER (c); 2503 2530 if (c == 'C' || c == 'D' || c == 'M' || c == 'R') 2504 2531 *type = c; … … 2664 2691 2665 2692 void 2693 s_bad_endr (ignore) 2694 int ignore ATTRIBUTE_UNUSED; 2695 { 2696 as_warn (_(".endr encountered without preceeding .rept, .irc, or .irp")); 2697 demand_empty_rest_of_line (); 2698 } 2699 2700 /* Handle the .rept pseudo-op. */ 2701 2702 void 2666 2703 s_rept (ignore) 2667 2704 int ignore ATTRIBUTE_UNUSED; … … 2741 2778 end_name = input_line_pointer; 2742 2779 *end_name = delim; 2780 2781 if (name == end_name) 2782 { 2783 as_bad (_("expected symbol name")); 2784 discard_rest_of_line (); 2785 return; 2786 } 2787 2743 2788 SKIP_WHITESPACE (); 2744 2789 … … 2746 2791 { 2747 2792 *end_name = 0; 2748 as_bad (_(" Expected comma after name\"%s\""), name);2793 as_bad (_("expected comma after \"%s\""), name); 2749 2794 *end_name = delim; 2750 2795 ignore_rest_of_line (); … … 2804 2849 && S_IS_DEFINED (symbolP) 2805 2850 && S_GET_SEGMENT (symbolP) != reg_section) 2806 as_bad (_("symbol `%s' already defined"), S_GET_NAME (symbolP));2851 as_bad (_("symbol `%s' is already defined"), S_GET_NAME (symbolP)); 2807 2852 2808 2853 pseudo_set (symbolP); … … 2890 2935 { 2891 2936 if (exp.X_op != O_constant) 2892 as_bad (_(" Unsupported variable size or fill value"));2937 as_bad (_("unsupported variable size or fill value")); 2893 2938 else 2894 2939 { … … 3015 3060 * letter is legal. */ 3016 3061 if (input_line_pointer[0] == '0' 3017 && isalpha ((unsigned char)input_line_pointer[1]))3062 && ISALPHA (input_line_pointer[1])) 3018 3063 input_line_pointer += 2; 3019 3064 … … 3040 3085 if (err) 3041 3086 { 3042 as_bad (_(" Bad floating literal: %s"), err);3087 as_bad (_("bad floating literal: %s"), err); 3043 3088 ignore_rest_of_line (); 3044 3089 if (flag_mri) … … 3113 3158 if (!is_end_of_line[(unsigned char) *input_line_pointer]) 3114 3159 { 3115 if ( isprint ((unsigned char)*input_line_pointer))3116 as_ bad (_("Rest of line ignored. First ignored character is `%c'."),3117 *input_line_pointer);3160 if (ISPRINT (*input_line_pointer)) 3161 as_warn (_("rest of line ignored; first ignored character is `%c'"), 3162 *input_line_pointer); 3118 3163 else 3119 as_ bad (_("Rest of line ignored. First ignored character valued 0x%x."),3120 *input_line_pointer);3164 as_warn (_("rest of line ignored; first ignored character valued 0x%x"), 3165 *input_line_pointer); 3121 3166 3122 3167 while (input_line_pointer < buffer_limit … … 3168 3213 3169 3214 if (exp.X_op == O_illegal) 3170 as_bad (_("illegal expression ; zero assumed"));3215 as_bad (_("illegal expression")); 3171 3216 else if (exp.X_op == O_absent) 3172 as_bad (_("missing expression ; zero assumed"));3217 as_bad (_("missing expression")); 3173 3218 else if (exp.X_op == O_big) 3174 3219 { 3175 3220 if (exp.X_add_number > 0) 3176 as_bad (_("bignum invalid ; zero assumed"));3221 as_bad (_("bignum invalid")); 3177 3222 else 3178 as_bad (_("floating point number invalid ; zero assumed"));3223 as_bad (_("floating point number invalid")); 3179 3224 } 3180 3225 else if (exp.X_op == O_subtract 3181 && (S_GET_SEGMENT (exp.X_add_symbol)3182 == S_GET_SEGMENT (exp.X_op_symbol))3183 3226 && SEG_NORMAL (S_GET_SEGMENT (exp.X_add_symbol)) 3184 3227 && (symbol_get_frag (exp.X_add_symbol) … … 3221 3264 symbol_set_value_expression (symbolP, &exp); 3222 3265 else if (symbol_section_p (symbolP)) 3223 as_bad (" invalidattempt to set value of section symbol");3266 as_bad ("attempt to set value of section symbol"); 3224 3267 else 3225 3268 { … … 3510 3553 else if (op == O_big && exp->X_add_number <= 0) 3511 3554 { 3512 as_bad (_("floating point number invalid ; zero assumed"));3555 as_bad (_("floating point number invalid")); 3513 3556 exp->X_add_number = 0; 3514 3557 op = O_constant; … … 3541 3584 x->addnum = exp->X_add_number; 3542 3585 x->added = 0; 3586 x->use_jump = 0; 3543 3587 new_broken_words++; 3544 3588 return; … … 3606 3650 || (get & hibit) == 0)) 3607 3651 { /* Leading bits contain both 0s & 1s. */ 3608 as_warn (_(" Value 0x%lx truncated to 0x%lx."),3652 as_warn (_("value 0x%lx truncated to 0x%lx"), 3609 3653 (unsigned long) get, (unsigned long) use); 3610 3654 } … … 3622 3666 if (nbytes < size) 3623 3667 { 3624 as_warn (_(" Bignum truncated to %d bytes"), nbytes);3668 as_warn (_("bignum truncated to %d bytes"), nbytes); 3625 3669 size = nbytes; 3626 3670 } … … 3636 3680 3637 3681 nums = generic_bignum + size / CHARS_PER_LITTLENUM; 3638 while (size > 0)3682 while (size >= CHARS_PER_LITTLENUM) 3639 3683 { 3640 3684 --nums; … … 3647 3691 { 3648 3692 nums = generic_bignum; 3649 while (size > 0)3693 while (size >= CHARS_PER_LITTLENUM) 3650 3694 { 3651 3695 md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM); … … 3656 3700 } 3657 3701 3658 while (nbytes > 0)3702 while (nbytes >= CHARS_PER_LITTLENUM) 3659 3703 { 3660 3704 md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM); … … 3956 4000 || count.X_add_number <= 0) 3957 4001 { 3958 as_warn (_(" Unresolvable or nonpositive repeat count; using 1"));4002 as_warn (_("unresolvable or nonpositive repeat count; using 1")); 3959 4003 return; 3960 4004 } … … 4008 4052 4009 4053 default: 4010 as_bad (_(" Unknown floating type type '%c'"), float_type);4054 as_bad (_("unknown floating type type '%c'"), float_type); 4011 4055 return -1; 4012 4056 } … … 4030 4074 if (i >= length) 4031 4075 { 4032 as_warn (_(" Floating point constant too large"));4076 as_warn (_("floating point constant too large")); 4033 4077 return -1; 4034 4078 } … … 4107 4151 diagnostics if your input is ill-conditioned. */ 4108 4152 if (input_line_pointer[0] == '0' 4109 && isalpha ((unsigned char)input_line_pointer[1]))4153 && ISALPHA (input_line_pointer[1])) 4110 4154 input_line_pointer += 2; 4111 4155 … … 4129 4173 if (err) 4130 4174 { 4131 as_bad (_(" Bad floating literal: %s"), err);4175 as_bad (_("bad floating literal: %s"), err); 4132 4176 ignore_rest_of_line (); 4133 4177 return; … … 4414 4458 else if (op == O_big && exp->X_add_number <= 0) 4415 4459 { 4416 as_bad (_("floating point number invalid ; zero assumed"));4460 as_bad (_("floating point number invalid")); 4417 4461 exp->X_add_number = 0; 4418 4462 op = O_constant; … … 4518 4562 c = ','; /* Do loop. */ 4519 4563 } 4564 /* If we have been switched into the abs_section then we 4565 will not have an obstack onto which we can hang strings. */ 4566 if (now_seg == absolute_section) 4567 { 4568 as_bad (_("strings must be placed into a section")); 4569 c = 0; 4570 ignore_rest_of_line (); 4571 } 4572 4520 4573 while (c == ',' || c == '<' || c == '"') 4521 4574 { … … 4563 4616 if (*input_line_pointer != '>') 4564 4617 { 4565 as_bad (_(" Expected <nn>"));4618 as_bad (_("expected <nn>")); 4566 4619 } 4567 4620 input_line_pointer++; … … 4597 4650 4598 4651 case '\n': 4599 as_warn (_(" Unterminated string: Newline inserted."));4652 as_warn (_("unterminated string; newline inserted")); 4600 4653 bump_line_counters (); 4601 4654 break; … … 4648 4701 4649 4702 for (i = 0, number = 0; 4650 isdigit(c) && i < 3;4703 ISDIGIT (c) && i < 3; 4651 4704 c = *input_line_pointer++, i++) 4652 4705 { … … 4666 4719 number = 0; 4667 4720 c = *input_line_pointer++; 4668 while ( isxdigit(c))4721 while (ISXDIGIT (c)) 4669 4722 { 4670 if ( isdigit(c))4723 if (ISDIGIT (c)) 4671 4724 number = number * 16 + c - '0'; 4672 else if ( isupper(c))4725 else if (ISUPPER (c)) 4673 4726 number = number * 16 + c - 'A' + 10; 4674 4727 else … … 4683 4736 case '\n': 4684 4737 /* To be compatible with BSD 4.2 as: give the luser a linefeed!! */ 4685 as_warn (_(" Unterminated string: Newline inserted."));4738 as_warn (_("unterminated string; newline inserted")); 4686 4739 c = '\n'; 4687 4740 bump_line_counters (); … … 4691 4744 4692 4745 #ifdef ONLY_STANDARD_ESCAPES 4693 as_bad (_(" Bad escaped character in string, '?' assumed"));4746 as_bad (_("bad escaped character in string")); 4694 4747 c = '?'; 4695 4748 #endif /* ONLY_STANDARD_ESCAPES */ … … 4718 4771 || expP->X_op == O_big) 4719 4772 { 4720 as_bad (_("expected address expression ; zero assumed"));4773 as_bad (_("expected address expression")); 4721 4774 expP->X_op = O_constant; 4722 4775 expP->X_add_number = 0; … … 4751 4804 4752 4805 offsetT 4806 get_absolute_expr (exp) 4807 expressionS *exp; 4808 { 4809 expression (exp); 4810 if (exp->X_op != O_constant) 4811 { 4812 if (exp->X_op != O_absent) 4813 as_bad (_("bad or irreducible absolute expression")); 4814 exp->X_add_number = 0; 4815 } 4816 return exp->X_add_number; 4817 } 4818 4819 offsetT 4753 4820 get_absolute_expression () 4754 4821 { 4755 4822 expressionS exp; 4756 4823 4757 expression (&exp); 4758 if (exp.X_op != O_constant) 4759 { 4760 if (exp.X_op != O_absent) 4761 as_bad (_("bad or irreducible absolute expression; zero assumed")); 4762 exp.X_add_number = 0; 4763 } 4764 return exp.X_add_number; 4824 return get_absolute_expr (&exp); 4765 4825 } 4766 4826 … … 4795 4855 len = 1; 4796 4856 *len_pointer = 0; 4797 as_bad (_(" This string may not contain \'\\0\'"));4857 as_bad (_("this string may not contain \'\\0\'")); 4798 4858 } 4799 4859 } … … 4833 4893 else 4834 4894 { 4835 as_warn (_(" Missing string"));4895 as_warn (_("missing string")); 4836 4896 retval = NULL; 4837 4897 ignore_rest_of_line (); … … 4898 4958 && S_IS_DEFINED (symbolP) 4899 4959 && S_GET_SEGMENT (symbolP) != reg_section) 4900 as_bad (_("symbol `%s' already defined"), S_GET_NAME (symbolP));4960 as_bad (_("symbol `%s' is already defined"), S_GET_NAME (symbolP)); 4901 4961 4902 4962 #ifdef OBJ_COFF … … 4917 4977 } 4918 4978 4979 /* .incbin -- include a file verbatim at the current location. */ 4980 4981 void 4982 s_incbin (x) 4983 int x ATTRIBUTE_UNUSED; 4984 { 4985 FILE * binfile; 4986 char * path; 4987 char * filename; 4988 char * binfrag; 4989 long skip = 0; 4990 long count = 0; 4991 long bytes; 4992 int len; 4993 4994 #ifdef md_flush_pending_output 4995 md_flush_pending_output (); 4996 #endif 4997 4998 SKIP_WHITESPACE (); 4999 filename = demand_copy_string (& len); 5000 if (filename == NULL) 5001 return; 5002 5003 SKIP_WHITESPACE (); 5004 5005 /* Look for optional skip and count. */ 5006 if (* input_line_pointer == ',') 5007 { 5008 ++ input_line_pointer; 5009 skip = get_absolute_expression (); 5010 5011 SKIP_WHITESPACE (); 5012 5013 if (* input_line_pointer == ',') 5014 { 5015 ++ input_line_pointer; 5016 5017 count = get_absolute_expression (); 5018 if (count == 0) 5019 as_warn (_(".incbin count zero, ignoring `%s'"), filename); 5020 5021 SKIP_WHITESPACE (); 5022 } 5023 } 5024 5025 demand_empty_rest_of_line (); 5026 5027 /* Try opening absolute path first, then try include dirs. */ 5028 binfile = fopen (filename, FOPEN_RB); 5029 if (binfile == NULL) 5030 { 5031 int i; 5032 5033 path = xmalloc ((unsigned long) len + include_dir_maxlen + 5); 5034 5035 for (i = 0; i < include_dir_count; i++) 5036 { 5037 sprintf (path, "%s/%s", include_dirs[i], filename); 5038 5039 binfile = fopen (path, FOPEN_RB); 5040 if (binfile != NULL) 5041 break; 5042 } 5043 5044 if (binfile == NULL) 5045 as_bad (_("file not found: %s"), filename); 5046 } 5047 else 5048 path = xstrdup (filename); 5049 5050 if (binfile) 5051 { 5052 long file_len; 5053 5054 register_dependency (path); 5055 5056 /* Compute the length of the file. */ 5057 if (fseek (binfile, 0, SEEK_END) != 0) 5058 { 5059 as_bad (_("seek to end of .incbin file failed `%s'"), path); 5060 goto done; 5061 } 5062 file_len = ftell (binfile); 5063 5064 /* If a count was not specified use the size of the file. */ 5065 if (count == 0) 5066 count = file_len; 5067 5068 if (skip + count > file_len) 5069 { 5070 as_bad (_("skip (%ld) + count (%ld) larger than file size (%ld)"), 5071 skip, count, file_len); 5072 goto done; 5073 } 5074 5075 if (fseek (binfile, skip, SEEK_SET) != 0) 5076 { 5077 as_bad (_("could not skip to %ld in file `%s'"), skip, path); 5078 goto done; 5079 } 5080 5081 /* Allocate frag space and store file contents in it. */ 5082 binfrag = frag_more (count); 5083 5084 bytes = fread (binfrag, 1, count, binfile); 5085 if (bytes < count) 5086 as_warn (_("truncated file `%s', %ld of %ld bytes read"), 5087 path, bytes, count); 5088 } 5089 done: 5090 if (binfile != NULL) 5091 fclose (binfile); 5092 if (path) 5093 free (path); 5094 } 5095 4919 5096 /* .include -- include a file at this point. */ 4920 5097 … … 4965 5142 strcat (path, "/"); 4966 5143 strcat (path, filename); 4967 if (0 != (try = fopen (path, "r")))5144 if (0 != (try = fopen (path, FOPEN_RT))) 4968 5145 { 4969 5146 fclose (try); -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.