diff mbox

[2/4,v2:,part,2] libcpp: Replace macro usage with C++ constructs

Message ID 874mle66vz.fsf@kepler.schwinge.homeip.net
State New
Headers show

Commit Message

Thomas Schwinge July 8, 2015, 2:50 p.m. UTC
Hi!

On Tue,  5 May 2015 14:21:13 -0400, David Malcolm <dmalcolm@redhat.com> wrote:
> libcpp/ChangeLog:
> 	* include/line-map.h (MAX_SOURCE_LOCATION): Convert from a macro
> 	to a const source_location.
> 	(RESERVED_LOCATION_COUNT): Likewise.
> 	[...]

> --- a/libcpp/include/line-map.h
> +++ b/libcpp/include/line-map.h

>  /* This is the highest possible source location encoded within an
>     ordinary or macro map.  */
> -#define MAX_SOURCE_LOCATION 0x7FFFFFFF
> +const source_location MAX_SOURCE_LOCATION = 0x7FFFFFFF;

>  /* source_location values from 0 to RESERVED_LOCATION_COUNT-1 will
>     be reserved for libcpp user as special values, no token from libcpp
>     will contain any of those locations.  */
> -#define RESERVED_LOCATION_COUNT	2
> +const int RESERVED_LOCATION_COUNT = 2;

That's not quite what the ChangeLog says ;-) -- now committed in r225558,
as obvious:

commit a5ea4da319fa2c7e9dd28e86bb69637a82e8e551
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed Jul 8 14:48:11 2015 +0000

    Address -Wsign-compare diagnostics
    
    ... which have been introduced in r223152, for example hundreds of:
    
        [...]/gcc/input.h:37:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    
    	libcpp/
    	* include/line-map.h (RESERVED_LOCATION_COUNT): Change type to
    	source_location.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225558 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libcpp/ChangeLog          |    5 +++++
 libcpp/include/line-map.h |    2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)



Grüße,
 Thomas

Comments

David Malcolm July 8, 2015, 3:06 p.m. UTC | #1
On Wed, 2015-07-08 at 16:50 +0200, Thomas Schwinge wrote:
> Hi!
> 
> On Tue,  5 May 2015 14:21:13 -0400, David Malcolm <dmalcolm@redhat.com> wrote:
> > libcpp/ChangeLog:
> > 	* include/line-map.h (MAX_SOURCE_LOCATION): Convert from a macro
> > 	to a const source_location.
> > 	(RESERVED_LOCATION_COUNT): Likewise.
> > 	[...]
> 
> > --- a/libcpp/include/line-map.h
> > +++ b/libcpp/include/line-map.h
> 
> >  /* This is the highest possible source location encoded within an
> >     ordinary or macro map.  */
> > -#define MAX_SOURCE_LOCATION 0x7FFFFFFF
> > +const source_location MAX_SOURCE_LOCATION = 0x7FFFFFFF;
> 
> >  /* source_location values from 0 to RESERVED_LOCATION_COUNT-1 will
> >     be reserved for libcpp user as special values, no token from libcpp
> >     will contain any of those locations.  */
> > -#define RESERVED_LOCATION_COUNT	2
> > +const int RESERVED_LOCATION_COUNT = 2;
> 
> That's not quite what the ChangeLog says ;-) -- now committed in r225558,
> as obvious

Oops; thanks!
diff mbox

Patch

diff --git libcpp/ChangeLog libcpp/ChangeLog
index 2d2893e..e72b535 100644
--- libcpp/ChangeLog
+++ libcpp/ChangeLog
@@ -1,3 +1,8 @@ 
+2015-07-08  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* include/line-map.h (RESERVED_LOCATION_COUNT): Change type to
+	source_location.
+
 2015-07-02  Paolo Carlini  <paolo.carlini@oracle.com>
 
 	PR preprocessor/53690
diff --git libcpp/include/line-map.h libcpp/include/line-map.h
index 4155156..bc747c1 100644
--- libcpp/include/line-map.h
+++ libcpp/include/line-map.h
@@ -870,7 +870,7 @@  bool linemap_location_from_macro_expansion_p (const struct line_maps *,
 /* source_location values from 0 to RESERVED_LOCATION_COUNT-1 will
    be reserved for libcpp user as special values, no token from libcpp
    will contain any of those locations.  */
-const int RESERVED_LOCATION_COUNT = 2;
+const source_location RESERVED_LOCATION_COUNT = 2;
 
 /* Converts a map and a source_location to source line.  */
 inline linenum_type