diff options
author | David Malcolm <dmalcolm@redhat.com> | 2017-11-13 19:07:26 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2017-11-13 19:07:26 +0000 |
commit | 846b84fba76e47260018d9f018b6491d53b96732 (patch) | |
tree | eaf090546b663d75935df3bf361aeeec6cb2fec0 /libcpp | |
parent | 4119b2eb4417054c98e0960a5dbe91284bdacdbf (diff) | |
download | gcc-846b84fba76e47260018d9f018b6491d53b96732.tar.gz |
libcpp: move line typedef and column-numbering comment to top of file
The description of our 1-based column-numbering convention was in
a non-obvious place withn line-map.h; this patch moves it to the top
of that header.
libcpp/ChangeLog:
* include/line-map.h (linenum_type): Move this typedef and the
comment describing column numbering to near the top of the file.
From-SVN: r254703
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 5 | ||||
-rw-r--r-- | libcpp/include/line-map.h | 46 |
2 files changed, 28 insertions, 23 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 86c42affded..35bcef90745 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,8 @@ +2017-11-13 David Malcolm <dmalcolm@redhat.com> + + * include/line-map.h (linenum_type): Move this typedef and the + comment describing column numbering to near the top of the file. + 2017-11-06 Mukesh Kapoor <mukesh.kapoor@oracle.com> PR c++/80955 diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h index e6960410c00..8b7e5dcd0ae 100644 --- a/libcpp/include/line-map.h +++ b/libcpp/include/line-map.h @@ -26,6 +26,29 @@ along with this program; see the file COPYING3. If not see #define GTY(x) /* nothing */ #endif +/* Both gcc and emacs number source *lines* starting at 1, but + they have differing conventions for *columns*. + + GCC uses a 1-based convention for source columns, + whereas Emacs's M-x column-number-mode uses a 0-based convention. + + For example, an error in the initial, left-hand + column of source line 3 is reported by GCC as: + + some-file.c:3:1: error: ...etc... + + On navigating to the location of that error in Emacs + (e.g. via "next-error"), + the locus is reported in the Mode Line + (assuming M-x column-number-mode) as: + + some-file.c 10% (3, 0) + + i.e. "3:1:" in GCC corresponds to "(3, 0)" in Emacs. */ + +/* The type of line numbers. */ +typedef unsigned int linenum_type; + /* Reason for creating a new line map with linemap_add. LC_ENTER is when including a new file, e.g. a #include directive in C. LC_LEAVE is when reaching a file's end. LC_RENAME is when a file @@ -43,9 +66,6 @@ enum lc_reason /* FIXME: add support for stringize and paste. */ }; -/* The type of line numbers. */ -typedef unsigned int linenum_type; - /* The typedef "source_location" is a key within the location database, identifying a source location or macro expansion, along with range information, and (optionally) a pointer for use by gcc. @@ -1251,26 +1271,6 @@ typedef struct bool sysp; } expanded_location; -/* Both gcc and emacs number source *lines* starting at 1, but - they have differing conventions for *columns*. - - GCC uses a 1-based convention for source columns, - whereas Emacs's M-x column-number-mode uses a 0-based convention. - - For example, an error in the initial, left-hand - column of source line 3 is reported by GCC as: - - some-file.c:3:1: error: ...etc... - - On navigating to the location of that error in Emacs - (e.g. via "next-error"), - the locus is reported in the Mode Line - (assuming M-x column-number-mode) as: - - some-file.c 10% (3, 0) - - i.e. "3:1:" in GCC corresponds to "(3, 0)" in Emacs. */ - /* A location within a rich_location: a caret&range, with the caret potentially flagged for display. */ |