]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Change of location_get_source_line signature
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 15 Sep 2015 16:53:01 +0000 (16:53 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Tue, 15 Sep 2015 16:53:01 +0000 (16:53 +0000)
gcc/ChangeLog:
* input.h (location_get_source_line): Drop "expanded_location"
param in favor of a file and line number.
* input.c (location_get_source_line): Likewise.
(dump_location_info): Update for change in signature of
location_get_source_line.
* diagnostic.c (diagnostic_print_caret_line): Likewise.

gcc/c-family/ChangeLog:
* c-format.c (location_from_offset): Update for change in
signature of location_get_source_line.
* c-indentation.c (get_visual_column): Likewise.
(line_contains_hash_if): Likewise.

From-SVN: r227800

gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-format.c
gcc/c-family/c-indentation.c
gcc/diagnostic.c
gcc/input.c
gcc/input.h

index 0305ca80d736fb5f2b7a8705df48c791f09729d0..455afc330fa8fbd9d341499689a4bc1b36fd02ad 100644 (file)
@@ -1,3 +1,12 @@
+2015-09-15  David Malcolm  <dmalcolm@redhat.com>
+
+       * input.h (location_get_source_line): Drop "expanded_location"
+       param in favor of a file and line number.
+       * input.c (location_get_source_line): Likewise.
+       (dump_location_info): Update for change in signature of
+       location_get_source_line.
+       * diagnostic.c (diagnostic_print_caret_line): Likewise.
+
 2015-09-15  Eric Botcazou  <ebotcazou@adacore.com>
 
        * defaults.h (STACK_OLD_CHECK_PROTECT): Adjust for -fno-exceptions.
index 888c28f505d629897f99c835e2612c18469dcded..140cda5c81cc7aac0476d3cdebf327a43ca5c363 100644 (file)
@@ -1,3 +1,10 @@
+2015-09-15  David Malcolm  <dmalcolm@redhat.com>
+
+       * c-format.c (location_from_offset): Update for change in
+       signature of location_get_source_line.
+       * c-indentation.c (get_visual_column): Likewise.
+       (line_contains_hash_if): Likewise.
+
 2015-09-14  Marek Polacek  <polacek@redhat.com>
 
        * c-opts.c (c_common_post_options): Set C++ standard earlier, before
index 2940f92d7d88581d8991f367f2f790c9238af168..ab5807662eb8e5415d9b3cb5e32ec5af16c02ae7 100644 (file)
@@ -132,7 +132,7 @@ location_from_offset (location_t loc, int offset)
 
   expanded_location s = expand_location_to_spelling_point (loc);
   int line_width;
-  const char *line = location_get_source_line (s, &line_width);
+  const char *line = location_get_source_line (s.file, s.line, &line_width);
   if (line == NULL)
     return loc;
   line += s.column - 1 ;
index fdfe0a9341272d086fb68b85bbb41b2dd88a7108..dd3522360b4a5c588a149f4339171eba0ad898fb 100644 (file)
@@ -45,7 +45,8 @@ get_visual_column (expanded_location exploc,
                   unsigned int *first_nws = NULL)
 {
   int line_len;
-  const char *line = location_get_source_line (exploc, &line_len);
+  const char *line = location_get_source_line (exploc.file, exploc.line,
+                                              &line_len);
   if (!line)
     return false;
   unsigned int vis_column = 0;
@@ -84,13 +85,8 @@ get_visual_column (expanded_location exploc,
 static bool
 line_contains_hash_if (const char *file, int line_num)
 {
-  expanded_location exploc;
-  exploc.file = file;
-  exploc.line = line_num;
-  exploc.column = 1;
-
   int line_len;
-  const char *line = location_get_source_line (exploc, &line_len);
+  const char *line = location_get_source_line (file, line_num, &line_len);
   if (!line)
     return false;
 
index e5c3c1dbfec20ee77012d4c13d206f9869708070..a1ffe72ea95b25d11d38e75227e522261c74eb82 100644 (file)
@@ -377,7 +377,8 @@ diagnostic_print_caret_line (diagnostic_context * context,
   
   int cmax = MAX (xloc1.column, xloc2.column);
   int line_width;
-  const char *line = location_get_source_line (xloc1, &line_width);
+  const char *line = location_get_source_line (xloc1.file, xloc1.line,
+                                              &line_width);
   if (line == NULL || cmax > line_width)
     return;
 
index 59cab5cebefd4d5d2945d572328ae808ba3e35d8..e7302a425897369e8d405467ffd9191b6ca9a62b 100644 (file)
@@ -684,27 +684,27 @@ read_line_num (fcache *c, size_t line_num,
   return read_next_line (c, line, line_len);
 }
 
-/* Return the physical source line that corresponds to xloc in a
+/* Return the physical source line that corresponds to FILE_PATH/LINE in a
    buffer that is statically allocated.  The newline is replaced by
    the null character.  Note that the line can contain several null
    characters, so LINE_LEN, if non-null, points to the actual length
    of the line.  */
 
 const char *
-location_get_source_line (expanded_location xloc,
+location_get_source_line (const char *file_path, int line,
                          int *line_len)
 {
   static char *buffer;
   static ssize_t len;
 
-  if (xloc.line == 0)
+  if (line == 0)
     return NULL;
 
-  fcache *c = lookup_or_add_file_to_cache_tab (xloc.file);
+  fcache *c = lookup_or_add_file_to_cache_tab (file_path);
   if (c == NULL)
     return NULL;
 
-  bool read = read_line_num (c, xloc.line, &buffer, &len);
+  bool read = read_line_num (c, line, &buffer, &len);
 
   if (read && line_len)
     *line_len = len;
@@ -971,7 +971,9 @@ dump_location_info (FILE *stream)
              /* Beginning of a new source line: draw the line.  */
 
              int line_size;
-             const char *line_text = location_get_source_line (exploc, &line_size);
+             const char *line_text = location_get_source_line (exploc.file,
+                                                               exploc.line,
+                                                               &line_size);
              if (!line_text)
                break;
              fprintf (stream,
index 5ba4d3b46f53f6ec8ec513ceecb0606aa8bae1e9..07d8544ed6f70fe98947f8152c6138a0f6481a84 100644 (file)
@@ -38,7 +38,7 @@ extern char builtins_location_check[(BUILTINS_LOCATION
 
 extern bool is_location_from_builtin_token (source_location);
 extern expanded_location expand_location (source_location);
-extern const char *location_get_source_line (expanded_location xloc,
+extern const char *location_get_source_line (const char *file_path, int line,
                                             int *line_size);
 extern expanded_location expand_location_to_spelling_point (source_location);
 extern source_location expansion_point_location_if_in_system_header (source_location);