From 2ac48ff1d4de309214fc291d07e7bde2578013c6 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 7 Feb 2020 11:12:23 +0100 Subject: [PATCH] Obj: make `no_location` constexpr This ensures that the variable is initialized at compile time and may allow the compiler to apply more initializations. --- src/Obj.cc | 1 - src/Obj.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Obj.cc b/src/Obj.cc index 91a9349d46..61ce530e08 100644 --- a/src/Obj.cc +++ b/src/Obj.cc @@ -10,7 +10,6 @@ #include "File.h" #include "plugin/Manager.h" -Location no_location("", 0, 0, 0, 0); Location start_location("", 0, 0, 0, 0); Location end_location("", 0, 0, 0, 0); diff --git a/src/Obj.h b/src/Obj.h index cc66274598..5652c8438c 100644 --- a/src/Obj.h +++ b/src/Obj.h @@ -31,7 +31,7 @@ typedef Location yyltype; YYLTYPE GetCurrentLocation(); // Used to mean "no location associated with this object". -extern Location no_location; +inline constexpr Location no_location("", 0, 0, 0, 0); // Current start/end location. extern Location start_location;