Skip to content

Commit

Permalink
fix: prefer includes in same directory
Browse files Browse the repository at this point in the history
Use quoted form instead of angle-bracket form for includes to avoid
conflicts between multiple versions of the library.
  • Loading branch information
sergiud committed Oct 7, 2023
1 parent 6a7be64 commit 6358a66
Show file tree
Hide file tree
Showing 28 changed files with 72 additions and 73 deletions.
2 changes: 1 addition & 1 deletion src/base/commandlineflags.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

#else

#include <glog/logging.h>
#include "glog/logging.h"

#define DECLARE_VARIABLE(type, shorttype, name, tn) \
namespace fL##shorttype { \
Expand Down
5 changes: 2 additions & 3 deletions src/cleanup_immediately_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include <glog/logging.h>
#include <glog/raw_logging.h>

#include "base/commandlineflags.h"
#include "glog/logging.h"
#include "glog/raw_logging.h"
#include "googletest.h"

#ifdef HAVE_LIB_GFLAGS
Expand Down
5 changes: 2 additions & 3 deletions src/cleanup_with_absolute_prefix_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include <glog/logging.h>
#include <glog/raw_logging.h>

#include "base/commandlineflags.h"
#include "glog/logging.h"
#include "glog/raw_logging.h"
#include "googletest.h"

#ifdef HAVE_LIB_GFLAGS
Expand Down
5 changes: 2 additions & 3 deletions src/cleanup_with_relative_prefix_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include <glog/logging.h>
#include <glog/raw_logging.h>

#include "base/commandlineflags.h"
#include "glog/logging.h"
#include "glog/raw_logging.h"
#include "googletest.h"

#ifdef HAVE_LIB_GFLAGS
Expand Down
2 changes: 1 addition & 1 deletion src/demangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
#define BASE_DEMANGLE_H_

#include "config.h"
#include <glog/logging.h>
#include "glog/logging.h"

_START_GOOGLE_NAMESPACE_

Expand Down
11 changes: 6 additions & 5 deletions src/demangle_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@
//
// Unit tests for functions in demangle.c.

#include "utilities.h"
#include "demangle.h"

#include <iostream>
#include <fstream>
#include <iostream>
#include <string>
#include <glog/logging.h>
#include "demangle.h"
#include "googletest.h"

#include "config.h"
#include "glog/logging.h"
#include "googletest.h"
#include "utilities.h"

#ifdef HAVE_LIB_GFLAGS
#include <gflags/gflags.h>
Expand Down
8 changes: 4 additions & 4 deletions src/glog/logging.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@
#define GLOG_MSVC_POP_WARNING()
#endif

#include <glog/platform.h>
#include "glog/platform.h"

#if @ac_cv_have_glog_export@
#include <glog/export.h>
#include "glog/export.h"
#endif

// We care a lot about number of bits things take up. Unfortunately,
Expand Down Expand Up @@ -599,8 +599,8 @@ DECLARE_string(logmailer);
@ac_google_start_namespace@

// They need the definitions of integer types.
#include <glog/log_severity.h>
#include <glog/vlog_is_on.h>
#include "glog/log_severity.h"
#include "glog/vlog_is_on.h"

// Initialize google's logging library. You will see the program name
// specified by argv0 in log outputs.
Expand Down
7 changes: 3 additions & 4 deletions src/glog/raw_logging.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@
#include <ctime>

@ac_google_start_namespace@

#include <glog/log_severity.h>
#include <glog/logging.h>
#include <glog/vlog_is_on.h>
#include "glog/log_severity.h"
#include "glog/logging.h"
#include "glog/vlog_is_on.h"

#if defined(__GNUC__)
#pragma GCC diagnostic push
Expand Down
4 changes: 2 additions & 2 deletions src/glog/vlog_is_on.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@
#ifndef BASE_VLOG_IS_ON_H_
#define BASE_VLOG_IS_ON_H_

#include <glog/log_severity.h>

#include <cstddef>

#include "glog/log_severity.h"

#if defined(__GNUC__)
// We emit an anonymous static int* variable at every VLOG_IS_ON(n) site.
// (Normally) the first time every VLOG_IS_ON(n) site is hit,
Expand Down
6 changes: 3 additions & 3 deletions src/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@
#else
#include <dirent.h> // for automatic removal of old logs
#endif
#include "base/commandlineflags.h" // to get the program name
#include <glog/logging.h>
#include <glog/raw_logging.h>
#include "base/commandlineflags.h" // to get the program name
#include "base/googleinit.h"
#include "glog/logging.h"
#include "glog/raw_logging.h"

#ifdef HAVE_STACKTRACE
# include "stacktrace.h"
Expand Down
5 changes: 3 additions & 2 deletions src/logging_striptest_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@
// The common part of the striplog tests.

#include <cstdio>
#include <string>
#include <iosfwd>
#include <glog/logging.h>
#include <string>

#include "base/commandlineflags.h"
#include "config.h"
#include "glog/logging.h"

DECLARE_bool(logtostderr);
GLOG_DEFINE_bool(check_mode, false, "Prints 'opt' or 'dbg'");
Expand Down
5 changes: 2 additions & 3 deletions src/logging_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,15 @@
#include <fstream>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <memory>
#include <queue>
#include <sstream>
#include <string>
#include <vector>

#include "base/commandlineflags.h"
#include <glog/logging.h>
#include <glog/raw_logging.h>
#include "glog/logging.h"
#include "glog/raw_logging.h"
#include "googletest.h"

DECLARE_string(log_backtrace_at); // logging.cc
Expand Down
7 changes: 3 additions & 4 deletions src/mock-log.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@
#define GLOG_SRC_MOCK_LOG_H_

// For GOOGLE_NAMESPACE. This must go first so we get _XOPEN_SOURCE.
#include "utilities.h"
#include <gmock/gmock.h>

#include <string>

#include <gmock/gmock.h>

#include <glog/logging.h>
#include "glog/logging.h"
#include "utilities.h"

_START_GOOGLE_NAMESPACE_
namespace glog_testing {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <glog/logging.h>
#include "glog/logging.h"

int main(int /*argc*/, char** argv)
{
Expand Down
10 changes: 6 additions & 4 deletions src/raw_logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@
#ifdef HAVE_UNISTD_H
# include <unistd.h> // for close() and write()
#endif
#include <fcntl.h> // for open()
#include <fcntl.h> // for open()

#include <ctime>
#include "config.h"
#include <glog/logging.h> // To pick up flag settings etc.
#include <glog/raw_logging.h>

#include "base/commandlineflags.h"
#include "config.h"
#include "glog/logging.h" // To pick up flag settings etc.
#include "glog/raw_logging.h"

#ifdef HAVE_STACKTRACE
# include "stacktrace.h"
Expand Down
10 changes: 5 additions & 5 deletions src/signalhandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
//
// Implementation of InstallFailureSignalHandler().

#include "utilities.h"
#include "stacktrace.h"
#include "symbolize.h"
#include <glog/logging.h>

#include <csignal>
#include <ctime>

#include "glog/logging.h"
#include "stacktrace.h"
#include "symbolize.h"
#include "utilities.h"
#ifdef HAVE_UCONTEXT_H
# include <ucontext.h>
#endif
Expand Down
3 changes: 2 additions & 1 deletion src/signalhandler_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
#include <cstdio>
#include <cstdlib>
#include <string>
#include <glog/logging.h>

#include "glog/logging.h"

#ifdef HAVE_LIB_GFLAGS
#include <gflags/gflags.h>
Expand Down
2 changes: 1 addition & 1 deletion src/stacktrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#define BASE_STACKTRACE_H_

#include "config.h"
#include <glog/logging.h>
#include "glog/logging.h"

_START_GOOGLE_NAMESPACE_

Expand Down
2 changes: 1 addition & 1 deletion src/stacktrace_libunwind-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extern "C" {
#define UNW_LOCAL_ONLY
#include <libunwind.h>
}
#include <glog/raw_logging.h>
#include "glog/raw_logging.h"
#include "stacktrace.h"

_START_GOOGLE_NAMESPACE_
Expand Down
9 changes: 5 additions & 4 deletions src/stacktrace_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "utilities.h"
#include "stacktrace.h"

#include <cstdio>
#include <cstdlib>
#include "config.h"

#include "base/commandlineflags.h"
#include <glog/logging.h>
#include "stacktrace.h"
#include "config.h"
#include "glog/logging.h"
#include "utilities.h"

#ifdef HAVE_EXECINFO_BACKTRACE_SYMBOLS
# include <execinfo.h>
Expand Down
4 changes: 2 additions & 2 deletions src/stl_logging_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include <glog/logging.h>
#include <glog/stl_logging.h>
#include "glog/stl_logging.h"

#include <functional>
#include <iostream>
Expand All @@ -38,6 +37,7 @@
#include <vector>

#include "config.h"
#include "glog/logging.h"
#include "googletest.h"

using namespace std;
Expand Down
2 changes: 1 addition & 1 deletion src/symbolize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ _END_GOOGLE_NAMESPACE_
#include <elf.h>
#endif
#include <fcntl.h>
#include <glog/raw_logging.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
Expand All @@ -133,6 +132,7 @@ _END_GOOGLE_NAMESPACE_
#include <cstring>

#include "config.h"
#include "glog/raw_logging.h"
#include "symbolize.h"

// Re-runs fn until it doesn't cause EINTR.
Expand Down
4 changes: 2 additions & 2 deletions src/symbolize.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
#ifndef BASE_SYMBOLIZE_H_
#define BASE_SYMBOLIZE_H_

#include "utilities.h"
#include "config.h"
#include <glog/logging.h>
#include "glog/logging.h"
#include "utilities.h"

#ifdef HAVE_SYMBOLIZE

Expand Down
3 changes: 1 addition & 2 deletions src/symbolize_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@

#include "symbolize.h"

#include <glog/logging.h>

#include <csignal>
#include <iostream>

#include "config.h"
#include "glog/logging.h"
#include "googletest.h"
#include "utilities.h"

Expand Down
5 changes: 2 additions & 3 deletions src/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@
#define PRIXS __PRIS_PREFIX "X"
#define PRIoS __PRIS_PREFIX "o"

#include "base/mutex.h" // This must go first so we get _XOPEN_SOURCE

#include <string>

#include <glog/logging.h>
#include "base/mutex.h" // This must go first so we get _XOPEN_SOURCE
#include "glog/logging.h"

#if defined(GLOG_OS_WINDOWS)
# include "port.h"
Expand Down
3 changes: 2 additions & 1 deletion src/utilities_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
//
// Author: Shinichiro Hamaji
#include "utilities.h"

#include "glog/logging.h"
#include "googletest.h"
#include <glog/logging.h>

#ifdef HAVE_LIB_GFLAGS
#include <gflags/gflags.h>
Expand Down
12 changes: 6 additions & 6 deletions src/vlog_is_on.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
// Broken out from logging.cc by Soren Lassen
// logging_unittest.cc covers the functionality herein

#include "utilities.h"

#include <cstring>
#include <cstdlib>
#include <cerrno>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>

#include "base/commandlineflags.h"
#include <glog/logging.h>
#include <glog/raw_logging.h>
#include "base/googleinit.h"
#include "glog/logging.h"
#include "glog/raw_logging.h"
#include "utilities.h"

// glog doesn't have annotation
#define ANNOTATE_BENIGN_RACE(address, description)
Expand Down
Loading

0 comments on commit 6358a66

Please sign in to comment.