Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use C++ headers #626

Merged
merged 1 commit into from
Mar 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ check_include_file_cxx (inttypes.h HAVE_INTTYPES_H)
check_include_file_cxx (memory.h HAVE_MEMORY_H)
check_include_file_cxx (pwd.h HAVE_PWD_H)
check_include_file_cxx (stdint.h HAVE_STDINT_H)
check_include_file_cxx (stdlib.h HAVE_STDLIB_H)
check_include_file_cxx (string.h HAVE_STRING_H)
check_include_file_cxx (strings.h HAVE_STRINGS_H)
check_include_file_cxx (sys/stat.h HAVE_SYS_STAT_H)
check_include_file_cxx (sys/syscall.h HAVE_SYS_SYSCALL_H)
Expand Down Expand Up @@ -142,24 +140,24 @@ check_cxx_compiler_flag (-Wunnamed-type-template-args

# NOTE: Cannot use check_function_exists here since >=vc-14.0 can define
# snprintf as an inline function
check_symbol_exists (snprintf stdio.h HAVE_SNPRINTF)
check_symbol_exists (snprintf cstdio HAVE_SNPRINTF)

check_library_exists (dbghelp UnDecorateSymbolName "" HAVE_DBGHELP)

check_cxx_source_compiles ("
#include <stdlib.h>
#include <cstdlib>
static void foo(void) __attribute__ ((unused));
int main(void) { return 0; }
" HAVE___ATTRIBUTE__)

check_cxx_source_compiles ("
#include <stdlib.h>
#include <cstdlib>
static void foo(void) __attribute__ ((visibility(\"default\")));
int main(void) { return 0; }
" HAVE___ATTRIBUTE__VISIBILITY_DEFAULT)

check_cxx_source_compiles ("
#include <stdlib.h>
#include <cstdlib>
static void foo(void) __attribute__ ((visibility(\"hidden\")));
int main(void) { return 0; }
" HAVE___ATTRIBUTE__VISIBILITY_HIDDEN)
Expand Down
10 changes: 5 additions & 5 deletions src/base/commandlineflags.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (c) 2008, Google Inc.
// All rights reserved.
//
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
Expand All @@ -14,7 +14,7 @@
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Expand Down Expand Up @@ -49,9 +49,9 @@
#define BASE_COMMANDLINEFLAGS_H__

#include "config.h"
#include <cstdlib> // for getenv
#include <cstring> // for memchr
#include <string>
#include <string.h> // for memchr
#include <stdlib.h> // for getenv

#ifdef HAVE_LIB_GFLAGS

Expand Down
4 changes: 2 additions & 2 deletions src/base/mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@

// We need to include these header files after defining _XOPEN_SOURCE
// as they may define the _XOPEN_SOURCE macro.
#include <assert.h>
#include <stdlib.h> // for abort()
#include <cassert>
#include <cstdlib> // for abort()

#define MUTEX_NAMESPACE glog_internal_namespace_

Expand Down
6 changes: 0 additions & 6 deletions src/config.h.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,9 @@
/* Define to 1 if you have the <stdint.h> header file. */
#cmakedefine HAVE_STDINT_H ${HAVE_STDINT_H}

/* Define to 1 if you have the <stdlib.h> header file. */
#cmakedefine HAVE_STDLIB_H

/* Define to 1 if you have the <strings.h> header file. */
#cmakedefine HAVE_STRINGS_H

/* Define to 1 if you have the <string.h> header file. */
#cmakedefine HAVE_STRING_H

/* Define to 1 if you have the <syscall.h> header file. */
#cmakedefine HAVE_SYSCALL_H

Expand Down
2 changes: 1 addition & 1 deletion src/demangle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
//
// Note that we only have partial C++0x support yet.

#include <stdio.h> // for NULL
#include <cstdio> // for NULL
#include "utilities.h"
#include "demangle.h"

Expand Down
6 changes: 3 additions & 3 deletions src/glog/logging.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
#ifndef _LOGGING_H_
#define _LOGGING_H_

#include <errno.h>
#include <string.h>
#include <time.h>
#include <cerrno>
#include <cstring>
#include <ctime>
#include <iosfwd>
#include <ostream>
#include <sstream>
Expand Down
2 changes: 1 addition & 1 deletion src/glog/raw_logging.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#ifndef BASE_RAW_LOGGING_H_
#define BASE_RAW_LOGGING_H_

#include <time.h>
#include <ctime>

@ac_google_start_namespace@

Expand Down
2 changes: 1 addition & 1 deletion src/glog/vlog_is_on.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
// // that can't be accomplished e.g. via just VLOG(2) << ...;
// }
//
// The truth value that VLOG_IS_ON(level) returns is determined by
// The truth value that VLOG_IS_ON(level) returns is determined by
// the three verbosity level flags:
// --v=<n> Gives the default maximal active V-logging level;
// 0 is the default.
Expand Down
10 changes: 5 additions & 5 deletions src/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "utilities.h"

#include <algorithm>
#include <assert.h>
#include <cassert>
#include <iomanip>
#include <string>
#ifdef HAVE_UNISTD_H
Expand All @@ -44,20 +44,20 @@
#ifdef HAVE_SYS_UTSNAME_H
# include <sys/utsname.h> // For uname.
#endif
#include <time.h>
#include <ctime>
#include <fcntl.h>
#include <cstdio>
#include <iostream>
#include <stdarg.h>
#include <stdlib.h>
#include <cstdarg>
#include <cstdlib>
#ifdef HAVE_PWD_H
# include <pwd.h>
#endif
#ifdef HAVE_SYSLOG_H
# include <syslog.h>
#endif
#include <vector>
#include <errno.h> // for errno
#include <cerrno> // for errno
#include <sstream>
#ifdef OS_WINDOWS
#include "windows/dirent.h"
Expand Down
2 changes: 1 addition & 1 deletion src/logging_striptest_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

// The common part of the striplog tests.

#include <stdio.h>
#include <cstdio>
#include <string>
#include <iosfwd>
#include "glog/logging.h"
Expand Down
7 changes: 3 additions & 4 deletions src/logging_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,17 @@
# include <sys/wait.h>
#endif

#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <memory>
#include <queue>
#include <sstream>
#include <string>
#include <vector>

#include <stdio.h>
#include <stdlib.h>

#include "base/commandlineflags.h"
#include "glog/logging.h"
#include "glog/raw_logging.h"
Expand Down
6 changes: 3 additions & 3 deletions src/raw_logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
#include "utilities.h"

#include <stdarg.h>
#include <stdio.h>
#include <errno.h>
#include <cstdio>
#include <cerrno>
#ifdef HAVE_UNISTD_H
# include <unistd.h> // for close() and write()
#endif
#include <fcntl.h> // for open()
#include <time.h>
#include <ctime>
#include "config.h"
#include "glog/logging.h" // To pick up flag settings etc.
#include "glog/raw_logging.h"
Expand Down
4 changes: 2 additions & 2 deletions src/signalhandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
#include "symbolize.h"
#include "glog/logging.h"

#include <signal.h>
#include <time.h>
#include <csignal>
#include <ctime>
#ifdef HAVE_UCONTEXT_H
# include <ucontext.h>
#endif
Expand Down
6 changes: 3 additions & 3 deletions src/signalhandler_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
#if defined(HAVE_PTHREAD)
# include <pthread.h>
#endif
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <string>
#include "glog/logging.h"

Expand Down
2 changes: 1 addition & 1 deletion src/stacktrace_powerpc-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
// http://www.linux-foundation.org/spec/ELF/ppc64/PPC-elf64abi-1.9.html#STACK
// Linux has similar code: http://patchwork.ozlabs.org/linuxppc/patch?id=8882

#include <stdio.h>
#include <cstdio>
#include <stdint.h> // for uintptr_t
#include "stacktrace.h"

Expand Down
4 changes: 2 additions & 2 deletions src/stacktrace_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

#include "utilities.h"

#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include "config.h"
#include "base/commandlineflags.h"
#include "glog/logging.h"
Expand Down
2 changes: 1 addition & 1 deletion src/stacktrace_x86-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <sys/mman.h>
#endif

#include <stdio.h> // for NULL
#include <cstdio> // for NULL
#include "stacktrace.h"

_START_GOOGLE_NAMESPACE_
Expand Down
5 changes: 2 additions & 3 deletions src/stacktrace_x86_64-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@
//
// Produce stack trace using libgcc

extern "C" {
#include <stdlib.h> // for NULL
#include <cstdlib> // for NULL
#include <unwind.h> // ABI defined unwinder
}

#include "stacktrace.h"

_START_GOOGLE_NAMESPACE_
Expand Down
18 changes: 9 additions & 9 deletions src/symbolize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

#if defined(HAVE_SYMBOLIZE)

#include <string.h>
#include <cstring>

#include <algorithm>
#include <limits>
Expand Down Expand Up @@ -118,14 +118,14 @@ _END_GOOGLE_NAMESPACE_
#else
#include <elf.h>
#endif
#include <errno.h>
#include <cerrno>
#include <climits>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fcntl.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
Expand Down Expand Up @@ -849,7 +849,7 @@ _END_GOOGLE_NAMESPACE_
#elif defined(OS_MACOSX) && defined(HAVE_DLADDR)

#include <dlfcn.h>
#include <string.h>
#include <cstring>

_START_GOOGLE_NAMESPACE_

Expand Down Expand Up @@ -951,7 +951,7 @@ _END_GOOGLE_NAMESPACE_

#else /* HAVE_SYMBOLIZE */

#include <assert.h>
#include <cassert>

#include "config.h"

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

#include "utilities.h"

#include <signal.h>
#include <csignal>
#include <iostream>

#include "glog/logging.h"
Expand Down
8 changes: 4 additions & 4 deletions src/utilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@

#include "utilities.h"

#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>

#include <signal.h>
#include <csignal>
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#include <time.h>
#include <ctime>
#if defined(HAVE_SYSCALL_H)
#include <syscall.h> // for syscall()
#elif defined(HAVE_SYS_SYSCALL_H)
Expand Down
6 changes: 3 additions & 3 deletions src/vlog_is_on.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@

#include "utilities.h"

#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <cstring>
#include <cstdlib>
#include <cerrno>
#include <cstdio>
#include <string>
#include "base/commandlineflags.h"
Expand Down
15 changes: 7 additions & 8 deletions src/windows/dirent.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@
#endif
#include <windows.h>

#include <stdio.h>
#include <stdarg.h>
#include <wchar.h>
#include <string.h>
#include <stdlib.h>
#include <malloc.h>
#include <sys/types.h>
#include <cerrno>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cwchar>
#include <sys/stat.h>
#include <errno.h>
#include <sys/types.h>

/* Indicates that d_type field is available in dirent structure */
#define _DIRENT_HAVE_D_TYPE
Expand Down
Loading