Ignore:
Timestamp:
Aug 16, 2003, 6:59:22 PM (22 years ago)
Author:
bird
Message:

binutils v2.14 - offical sources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/binutils/gas/read.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* read.c - read a source file -
    22   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.
    44
    55This file is part of GAS, the GNU Assembler.
     
    3636   Another group of these functions is in the expr.c module.  */
    3737
    38 /* For isdigit ().  */
    39 #include <ctype.h>
    40 
    4138#include "as.h"
     39#include "safe-ctype.h"
    4240#include "subsegs.h"
    4341#include "sb.h"
     
    4846
    4947#ifndef TC_START_LABEL
    50 #define TC_START_LABEL(x,y) (x==':')
     48#define TC_START_LABEL(x,y) (x == ':')
    5149#endif
    5250
     
    170168   internals manual.  */
    171169int 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;
    176170
    177171/* Variables for handling include file directory table.  */
     
    320314  {"endfunc", s_func, 1},
    321315  {"endif", s_endif, 0},
     316  {"endr", s_bad_endr, 0},
    322317/* endef  */
    323318  {"equ", s_set, 0},
     
    352347  {"ifnes", s_ifeqs, 1},
    353348  {"ifnotdef", s_ifdef, 1},
     349  {"incbin", s_incbin, 0},
    354350  {"include", s_include, 0},
    355351  {"int", cons, 4},
     
    537533    {                           /* We have another line to parse.  */
    538534      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
    542536      while (input_line_pointer < buffer_limit)
    543537        {
     
    742736                    while (*s2)
    743737                      {
    744                         if (isupper ((unsigned char) *s2))
    745                           *s2 = tolower (*s2);
     738                        *s2 = TOLOWER (*s2);
    746739                        s2++;
    747740                      }
     
    803796                      if (pop == NULL)
    804797                        {
    805                           as_bad (_("Unknown pseudo-op: `%s'"), s);
     798                          as_bad (_("unknown pseudo-op: `%s'"), s);
    806799                          *input_line_pointer = c;
    807800                          s_ignore (0);
     
    867860                          macro_entry *macro;
    868861
    869                           if (check_macro (s, &out, '\0', &err, &macro))
     862                          if (check_macro (s, &out, &err, &macro))
    870863                            {
    871864                              if (err != NULL)
     
    910903            continue;
    911904
    912           if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB)
    913               && isdigit ((unsigned char) c))
     905          if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB) && ISDIGIT (c))
    914906            {
    915907              /* local label  ("4:")  */
     
    921913
    922914              /* Read the whole number.  */
    923               while (isdigit ((unsigned char) *input_line_pointer))
     915              while (ISDIGIT (*input_line_pointer))
    924916                {
    925917                  temp = (temp * 10) + *input_line_pointer - '0';
     
    956948          if (c && strchr (line_comment_chars, c))
    957949            {                   /* Its a comment.  Better say APP or NO_APP.  */
     950              sb sbuf;
    958951              char *ends;
    959952              char *new_buf;
     
    968961              s += 4;
    969962
     963              sb_new (&sbuf);
    970964              ends = strstr (s, "#NO_APP\n");
    971965
     
    10291023                  if (size < space)
    10301024                    {
    1031                       new_tmp += size;
     1025                      new_tmp[size] = 0;
    10321026                      break;
    10331027                    }
     
    10401034              if (tmp_buf)
    10411035                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);
    10491049              continue;
    10501050            }
     
    10561056            continue;
    10571057#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.  */
    10601060          ignore_rest_of_line ();
    10611061        }
     
    10641064      md_after_pass_hook ();
    10651065#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         }
    10801066    }
    10811067
     
    11691155     int max;
    11701156{
     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
    11711170#ifdef md_do_align
    11721171  md_do_align (n, fill, len, max, just_record_alignment);
     
    11901189
    11911190#ifdef md_do_align
    1192  just_record_alignment:
     1191 just_record_alignment: ATTRIBUTE_UNUSED_LABEL
    11931192#endif
    11941193
     
    12391238            ;
    12401239          if (align != 1)
    1241             as_bad (_("Alignment not a power of 2"));
     1240            as_bad (_("alignment not a power of 2"));
    12421241
    12431242          align = i;
     
    12481247    {
    12491248      align = 15;
    1250       as_bad (_("Alignment too large: %u assumed"), align);
     1249      as_warn (_("alignment too large: %u assumed"), align);
    12511250    }
    12521251
     
    13551354  p = input_line_pointer;
    13561355  *p = c;
     1356
     1357  if (name == p)
     1358    {
     1359      as_bad (_("expected symbol name"));
     1360      discard_rest_of_line ();
     1361      return;
     1362    }
     1363
    13571364  SKIP_WHITESPACE ();
    13581365
    13591366  if (*input_line_pointer != ',')
    13601367    {
    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;
    13621371      ignore_rest_of_line ();
    13631372      if (flag_mri)
     
    13701379  if ((temp = get_absolute_expression ()) < 0)
    13711380    {
    1372       as_warn (_(".COMMon length (%ld.) <0! Ignored."), (long) temp);
     1381      as_warn (_(".COMMon length (%ld) < 0 ignored"), (long) temp);
    13731382      ignore_rest_of_line ();
    13741383      if (flag_mri)
     
    13831392  if (S_IS_DEFINED (symbolP) && !S_IS_COMMON (symbolP))
    13841393    {
    1385       as_bad (_("Ignoring attempt to re-define symbol `%s'."),
     1394      as_bad (_("symbol `%s' is already defined"),
    13861395              S_GET_NAME (symbolP));
    13871396      ignore_rest_of_line ();
     
    13941403    {
    13951404      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"),
    13971406                S_GET_NAME (symbolP),
    13981407                (long) S_GET_VALUE (symbolP),
     
    14461455
    14471456  name = input_line_pointer;
    1448   if (!isdigit ((unsigned char) *name))
     1457  if (!ISDIGIT (*name))
    14491458    c = get_symbol_end ();
    14501459  else
     
    14541463          ++input_line_pointer;
    14551464        }
    1456       while (isdigit ((unsigned char) *input_line_pointer));
     1465      while (ISDIGIT (*input_line_pointer));
    14571466
    14581467      c = *input_line_pointer;
     
    14841493  if (S_IS_DEFINED (sym) && !S_IS_COMMON (sym))
    14851494    {
    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));
    14871496      ignore_rest_of_line ();
    14881497      mri_comment_end (stop, stopc);
     
    15551564
    15561565void
     1566s_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
     1579void
    15571580s_app_file (appfile)
    15581581     int appfile;
     
    15791602      demand_empty_rest_of_line ();
    15801603      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);
    15911605    }
    15921606}
     
    16081622    /* Some of the back ends can't deal with non-positive line numbers.
    16091623       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"),
    16111625             l + 1);
    16121626  else
     
    17041718  if (size > BSD_FILL_SIZE_CROCK_8)
    17051719    {
    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);
    17071721      size = BSD_FILL_SIZE_CROCK_8;
    17081722    }
    17091723  if (size < 0)
    17101724    {
    1711       as_warn (_("Size negative: .fill ignored."));
     1725      as_warn (_("size negative; .fill ignored"));
    17121726      size = 0;
    17131727    }
     
    17151729    {
    17161730      if (rep_exp.X_add_number < 0)
    1717         as_warn (_("Repeat < 0, .fill ignored"));
     1731        as_warn (_("repeat < 0; .fill ignored"));
    17181732      size = 0;
    17191733    }
     
    17571771
    17581772      /* The magic number BSD_FILL_SIZE_CROCK_4 is from BSD 4.2 VAX
    1759          flavoured AS.  The following bizzare behaviour is to be
     1773         flavoured AS.  The following bizarre behaviour is to be
    17601774         compatible with above.  I guess they tried to take up to 8
    17611775         bytes from a 4-byte expression and they forgot to sign
    1762          extend. Un*x Sux. */
     1776         extend. */
    17631777#define BSD_FILL_SIZE_CROCK_4 (4)
    17641778      md_number_to_chars (p, (valueT) fill,
     
    18011815          input_line_pointer++;
    18021816          SKIP_WHITESPACE ();
    1803           if (*input_line_pointer == '\n')
     1817          if (is_end_of_line[(unsigned char) *input_line_pointer])
    18041818            c = '\n';
    18051819        }
     
    18331847  sb_new (&out);
    18341848
    1835   err = expand_irp (irpc, 0, &s, &out, get_line_sb, '\0');
     1849  err = expand_irp (irpc, 0, &s, &out, get_line_sb);
    18361850  if (err != NULL)
    18371851    as_bad_where (file, line, "%s", err);
     
    19451959  p = input_line_pointer;
    19461960  *p = c;
     1961
     1962  if (name == p)
     1963    {
     1964      as_bad (_("expected symbol name"));
     1965      discard_rest_of_line ();
     1966      return;
     1967    }
     1968
    19471969  SKIP_WHITESPACE ();
    19481970
     
    19551977    }
    19561978
    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"));
    19601982      return;
    19611983    }
     
    19631985  if ((temp = get_absolute_expression ()) < 0)
    19641986    {
    1965       as_warn (_("BSS length (%d.) <0! Ignored."), temp);
     1987      as_warn (_("BSS length (%d) < 0 ignored"), temp);
    19661988      ignore_rest_of_line ();
    19671989      return;
     
    19731995    {
    19741996      /* 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))
    19761998        {
    19771999          bss_seg = subseg_new (".sbss", 1);
     
    20022024      if (*input_line_pointer != ',')
    20032025        {
    2004           as_bad (_("Expected comma after size"));
     2026          as_bad (_("expected comma after size"));
    20052027          ignore_rest_of_line ();
    20062028          return;
     
    20102032      SKIP_WHITESPACE ();
    20112033
    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"));
    20152037          return;
    20162038        }
     
    20282050                ;
    20292051              if (align != 1)
    2030                 as_bad (_("Alignment not a power of 2"));
     2052                as_bad (_("alignment not a power of 2"));
    20312053              align = i;
    20322054            }
     
    20362058        {
    20372059          align = max_alignment;
    2038           as_warn (_("Alignment too large: %d. assumed."), align);
     2060          as_warn (_("alignment too large; %d assumed"), align);
    20392061        }
    20402062      else if (align < 0)
    20412063        {
    20422064          align = 0;
    2043           as_warn (_("Alignment negative. 0 assumed."));
     2065          as_warn (_("alignment negative; 0 assumed"));
    20442066        }
    20452067
     
    21092131    }
    21102132  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));
    21132134
    21142135  subseg_set (current_seg, current_subseg);
     
    21462167  p = input_line_pointer;
    21472168  *p = c;
     2169
     2170  if (name == p)
     2171    {
     2172      as_bad (_("expected symbol name"));
     2173      discard_rest_of_line ();
     2174      return;
     2175    }
     2176
    21482177  SKIP_WHITESPACE ();
    21492178
     
    21512180    {
    21522181      *p = 0;
    2153       as_bad (_("Expected comma after name \"%s\""), name);
     2182      as_bad (_("expected comma after \"%s\""), name);
    21542183      *p = c;
    21552184      ignore_rest_of_line ();
     
    21912220  else
    21922221    {
    2193       as_bad (_("Symbol %s already defined"), name);
     2222      as_bad (_("symbol `%s' is already defined"), name);
    21942223    }
    21952224
     
    21982227}
    21992228
    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.  */
    22012231
    22022232static int
     
    22052235{
    22062236  char quote1, quote2, inquote;
     2237  unsigned char c;
    22072238
    22082239  if (input_line_pointer[-1] == '\n')
     
    22322263  inquote = '\0';
    22332264
    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)
    22382270        inquote = '\0';
    22392271      else if (inquote == '\0')
    22402272        {
    2241           if (*input_line_pointer == quote1)
     2273          if (c == quote1)
    22422274            inquote = quote1;
    2243           else if (*input_line_pointer == quote2)
     2275          else if (c == quote2)
    22442276            inquote = quote2;
    22452277        }
    22462278
    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.  */
    22632291
    22642292void
     
    23662394{
    23672395  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));
    23702397
    23712398  if (now_seg == absolute_section)
     
    24672494
    24682495  name = input_line_pointer;
    2469   if (!isdigit ((unsigned char) *name))
     2496  if (!ISDIGIT (*name))
    24702497    c = get_symbol_end ();
    24712498  else
     
    24752502          ++input_line_pointer;
    24762503        }
    2477       while (isdigit ((unsigned char) *input_line_pointer));
     2504      while (ISDIGIT (*input_line_pointer));
    24782505
    24792506      c = *input_line_pointer;
     
    25002527    {
    25012528      c = *++input_line_pointer;
    2502       c = toupper ((unsigned char) c);
     2529      c = TOUPPER (c);
    25032530      if (c == 'C' || c == 'D' || c == 'M' || c == 'R')
    25042531        *type = c;
     
    26642691
    26652692void
     2693s_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
     2702void
    26662703s_rept (ignore)
    26672704     int ignore ATTRIBUTE_UNUSED;
     
    27412778  end_name = input_line_pointer;
    27422779  *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
    27432788  SKIP_WHITESPACE ();
    27442789
     
    27462791    {
    27472792      *end_name = 0;
    2748       as_bad (_("Expected comma after name \"%s\""), name);
     2793      as_bad (_("expected comma after \"%s\""), name);
    27492794      *end_name = delim;
    27502795      ignore_rest_of_line ();
     
    28042849      && S_IS_DEFINED (symbolP)
    28052850      && 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));
    28072852
    28082853  pseudo_set (symbolP);
     
    28902935    {
    28912936      if (exp.X_op != O_constant)
    2892         as_bad (_("Unsupported variable size or fill value"));
     2937        as_bad (_("unsupported variable size or fill value"));
    28932938      else
    28942939        {
     
    30153060   * letter is legal.  */
    30163061  if (input_line_pointer[0] == '0'
    3017       && isalpha ((unsigned char) input_line_pointer[1]))
     3062      && ISALPHA (input_line_pointer[1]))
    30183063    input_line_pointer += 2;
    30193064
     
    30403085      if (err)
    30413086        {
    3042           as_bad (_("Bad floating literal: %s"), err);
     3087          as_bad (_("bad floating literal: %s"), err);
    30433088          ignore_rest_of_line ();
    30443089          if (flag_mri)
     
    31133158  if (!is_end_of_line[(unsigned char) *input_line_pointer])
    31143159    {
    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);
    31183163      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);
    31213166
    31223167      while (input_line_pointer < buffer_limit
     
    31683213
    31693214  if (exp.X_op == O_illegal)
    3170     as_bad (_("illegal expression; zero assumed"));
     3215    as_bad (_("illegal expression"));
    31713216  else if (exp.X_op == O_absent)
    3172     as_bad (_("missing expression; zero assumed"));
     3217    as_bad (_("missing expression"));
    31733218  else if (exp.X_op == O_big)
    31743219    {
    31753220      if (exp.X_add_number > 0)
    3176         as_bad (_("bignum invalid; zero assumed"));
     3221        as_bad (_("bignum invalid"));
    31773222      else
    3178         as_bad (_("floating point number invalid; zero assumed"));
     3223        as_bad (_("floating point number invalid"));
    31793224    }
    31803225  else if (exp.X_op == O_subtract
    3181            && (S_GET_SEGMENT (exp.X_add_symbol)
    3182                == S_GET_SEGMENT (exp.X_op_symbol))
    31833226           && SEG_NORMAL (S_GET_SEGMENT (exp.X_add_symbol))
    31843227           && (symbol_get_frag (exp.X_add_symbol)
     
    32213264        symbol_set_value_expression (symbolP, &exp);
    32223265      else if (symbol_section_p (symbolP))
    3223         as_bad ("invalid attempt to set value of section symbol");
     3266        as_bad ("attempt to set value of section symbol");
    32243267      else
    32253268        {
     
    35103553  else if (op == O_big && exp->X_add_number <= 0)
    35113554    {
    3512       as_bad (_("floating point number invalid; zero assumed"));
     3555      as_bad (_("floating point number invalid"));
    35133556      exp->X_add_number = 0;
    35143557      op = O_constant;
     
    35413584      x->addnum = exp->X_add_number;
    35423585      x->added = 0;
     3586      x->use_jump = 0;
    35433587      new_broken_words++;
    35443588      return;
     
    36063650              || (get & hibit) == 0))
    36073651        {               /* 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"),
    36093653                   (unsigned long) get, (unsigned long) use);
    36103654        }
     
    36223666      if (nbytes < size)
    36233667        {
    3624           as_warn (_("Bignum truncated to %d bytes"), nbytes);
     3668          as_warn (_("bignum truncated to %d bytes"), nbytes);
    36253669          size = nbytes;
    36263670        }
     
    36363680
    36373681          nums = generic_bignum + size / CHARS_PER_LITTLENUM;
    3638           while (size > 0)
     3682          while (size >= CHARS_PER_LITTLENUM)
    36393683            {
    36403684              --nums;
     
    36473691        {
    36483692          nums = generic_bignum;
    3649           while (size > 0)
     3693          while (size >= CHARS_PER_LITTLENUM)
    36503694            {
    36513695              md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
     
    36563700            }
    36573701
    3658           while (nbytes > 0)
     3702          while (nbytes >= CHARS_PER_LITTLENUM)
    36593703            {
    36603704              md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM);
     
    39564000      || count.X_add_number <= 0)
    39574001    {
    3958       as_warn (_("Unresolvable or nonpositive repeat count; using 1"));
     4002      as_warn (_("unresolvable or nonpositive repeat count; using 1"));
    39594003      return;
    39604004    }
     
    40084052
    40094053    default:
    4010       as_bad (_("Unknown floating type type '%c'"), float_type);
     4054      as_bad (_("unknown floating type type '%c'"), float_type);
    40114055      return -1;
    40124056    }
     
    40304074      if (i >= length)
    40314075        {
    4032           as_warn (_("Floating point constant too large"));
     4076          as_warn (_("floating point constant too large"));
    40334077          return -1;
    40344078        }
     
    41074151         diagnostics if your input is ill-conditioned.  */
    41084152      if (input_line_pointer[0] == '0'
    4109           && isalpha ((unsigned char) input_line_pointer[1]))
     4153          && ISALPHA (input_line_pointer[1]))
    41104154        input_line_pointer += 2;
    41114155
     
    41294173          if (err)
    41304174            {
    4131               as_bad (_("Bad floating literal: %s"), err);
     4175              as_bad (_("bad floating literal: %s"), err);
    41324176              ignore_rest_of_line ();
    41334177              return;
     
    44144458  else if (op == O_big && exp->X_add_number <= 0)
    44154459    {
    4416       as_bad (_("floating point number invalid; zero assumed"));
     4460      as_bad (_("floating point number invalid"));
    44174461      exp->X_add_number = 0;
    44184462      op = O_constant;
     
    45184562      c = ',';                  /* Do loop.  */
    45194563    }
     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 
    45204573  while (c == ',' || c == '<' || c == '"')
    45214574    {
     
    45634616          if (*input_line_pointer != '>')
    45644617            {
    4565               as_bad (_("Expected <nn>"));
     4618              as_bad (_("expected <nn>"));
    45664619            }
    45674620          input_line_pointer++;
     
    45974650
    45984651    case '\n':
    4599       as_warn (_("Unterminated string: Newline inserted."));
     4652      as_warn (_("unterminated string; newline inserted"));
    46004653      bump_line_counters ();
    46014654      break;
     
    46484701
    46494702            for (i = 0, number = 0;
    4650                  isdigit (c) && i < 3;
     4703                 ISDIGIT (c) && i < 3;
    46514704                 c = *input_line_pointer++, i++)
    46524705              {
     
    46664719            number = 0;
    46674720            c = *input_line_pointer++;
    4668             while (isxdigit (c))
     4721            while (ISXDIGIT (c))
    46694722              {
    4670                 if (isdigit (c))
     4723                if (ISDIGIT (c))
    46714724                  number = number * 16 + c - '0';
    4672                 else if (isupper (c))
     4725                else if (ISUPPER (c))
    46734726                  number = number * 16 + c - 'A' + 10;
    46744727                else
     
    46834736        case '\n':
    46844737          /* 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"));
    46864739          c = '\n';
    46874740          bump_line_counters ();
     
    46914744
    46924745#ifdef ONLY_STANDARD_ESCAPES
    4693           as_bad (_("Bad escaped character in string, '?' assumed"));
     4746          as_bad (_("bad escaped character in string"));
    46944747          c = '?';
    46954748#endif /* ONLY_STANDARD_ESCAPES */
     
    47184771      || expP->X_op == O_big)
    47194772    {
    4720       as_bad (_("expected address expression; zero assumed"));
     4773      as_bad (_("expected address expression"));
    47214774      expP->X_op = O_constant;
    47224775      expP->X_add_number = 0;
     
    47514804
    47524805offsetT
     4806get_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
     4819offsetT
    47534820get_absolute_expression ()
    47544821{
    47554822  expressionS exp;
    47564823
    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);
    47654825}
    47664826
     
    47954855              len = 1;
    47964856              *len_pointer = 0;
    4797               as_bad (_("This string may not contain \'\\0\'"));
     4857              as_bad (_("this string may not contain \'\\0\'"));
    47984858            }
    47994859        }
     
    48334893  else
    48344894    {
    4835       as_warn (_("Missing string"));
     4895      as_warn (_("missing string"));
    48364896      retval = NULL;
    48374897      ignore_rest_of_line ();
     
    48984958          && S_IS_DEFINED (symbolP)
    48994959          && 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));
    49014961
    49024962#ifdef OBJ_COFF
     
    49174977}
    49184978
     4979/* .incbin -- include a file verbatim at the current location.  */
     4980
     4981void
     4982s_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    }
     5089done:
     5090  if (binfile != NULL)
     5091    fclose (binfile);
     5092  if (path)
     5093    free (path);
     5094}
     5095
    49195096/* .include -- include a file at this point.  */
    49205097
     
    49655142      strcat (path, "/");
    49665143      strcat (path, filename);
    4967       if (0 != (try = fopen (path, "r")))
     5144      if (0 != (try = fopen (path, FOPEN_RT)))
    49685145        {
    49695146          fclose (try);
Note: See TracChangeset for help on using the changeset viewer.