Commit Graph

548 Commits

Author SHA1 Message Date
Daiki Maekawa
2faa186e62 cmake: added BUILD_SHARED_LIBS option (#313) 2018-04-26 08:46:24 +02:00
Ruslan Baratov
d064ab8d0a Fix build for Android API < 21 2018-04-22 23:54:24 +03:00
Rodrigo Queiro
e0341da07b Add Bazel CI configuration
This was previously present in
https://github.com/bazelbuild/continuous-integration, but the Bazel team
asked us to move it to our repo. It will be helpful if we need to change
the build configuration, eg to add new platforms.
2018-04-18 11:54:56 +02:00
Akiyoshi Ochiai
dd2b93d761 Fix __attribute__((noreturn)) mismatch warning in Bazel build 2018-04-18 10:15:54 +02:00
Sergiu Deitsch
2f493d292c
Merge pull request #302 from Nazg-Gul/missing-prototype
Resolve missing prototype warning
2018-03-21 13:45:06 +01:00
Sergiu Deitsch
11afec2795
Merge pull request #303 from Nazg-Gul/reincluded-config
Fix redefined warnings from config.h
2018-03-21 13:44:44 +01:00
Shinichiro Hamaji
643f6d4678
Merge pull request #305 from samuela/patch-1
Make int conversion explicit and fix clang warning
2018-03-21 21:43:40 +09:00
samuela
838753987f
Make int conversion explicit and fix clang warning 2018-03-20 18:03:46 -07:00
Sergey Sharybin
418f9020e3 Fix redefined warnings from config.h
The issue was caused by config.h header being included from both
header files and implementation files.

Proposed solution is to have regular header guard in the generated
config.h. Benefit of this solution is that it's least intrusive.
Downside is that it only solves issue for CMake build system, and
autoconf one is not fixed since header template is automatically
generated by autoheader who does not add header guard.
2018-03-20 11:14:06 +01:00
Shinichiro Hamaji
1fe7e94ac6
Merge pull request #304 from Nazg-Gul/terminfo-konsole
konsole family of terminfo supports colored output
2018-03-20 18:14:33 +09:00
Sergey Sharybin
e35bb111c3 konsole family of terminfo supports colored output
Glog was missing colored output when running in terminal
who is set to konsole* TERM, even though the terminal
itself supports colored output.

Add extra terminfo to the check function, so now output
from Glog is properly colored.
2018-03-20 09:49:07 +01:00
Sergiu Deitsch
43dafc5bf2 cmake: fixed gcc warning 2018-03-19 00:21:33 +01:00
Sergiu Deitsch
a97d6b0e1c
Symbolizer support for mingw and cygwin (#208)
* added dbghelp symbolizer support for mingw and cygwin
* fixed compiler errors in case <stdint.h> is not available
* cmake: check whether SymFromAddr actually works
2018-02-27 21:03:20 +01:00
Sergiu Deitsch
1aec14edf4 cmake: do not introduce a policy stack in the package config 2018-02-23 10:16:24 +01:00
Sergiu Deitsch
4c4631c9b3
Merge pull request #292 from Mizux/master
CMake Update
2018-02-10 14:34:47 +01:00
Corentin Le Molgat
6b6e38a7d5 Rework CMake glog VERSION management.
- Use of Project version properties instead of custom variables
- fix missmatch between VERSION (build version) and SOVERSION (API version)
src: https://cmake.org/cmake/help/latest/prop_tgt/VERSION.html#prop_tgt:VERSION
2018-02-06 10:37:26 +01:00
Corentin Le Molgat
4ef88d510e remove uneeded enable_testing()
CTest module already provides it
2018-02-06 10:37:26 +01:00
Corentin Le Molgat
cbfd86a1d8 Provide glog::glog ALIAs
Useful when using glog as subproject.
Add an explanation at top like in gflags.git CMakeLists.txt
2018-02-06 10:37:26 +01:00
Rodrigo Queiro
55cc27b6ec Bazel: make example more portable 2018-02-01 14:13:46 +01:00
Rodrigo Queiro
bc9a491033 Allow using glog/stl_logging.h with Bazel
Fixes #289.
2018-02-01 14:13:46 +01:00
Rodrigo Queiro
3106945d8d Add workaround for Bazel build on macOS
This works around https://github.com/bazelbuild/bazel/issues/3979,
and so closes #282.
2018-01-16 17:06:15 +01:00
Sergiu Deitsch
028d37889a cmake: remove config.h from public headers (closes #238) 2018-01-04 15:20:26 +01:00
Sergiu Deitsch
fb19c33b00
Merge pull request #283 from Mizux/master
Use target gflags instead of old VARIABLES
2018-01-04 14:38:21 +01:00
Mizux
63871d3e29
Use target gflags instead of old VARIABLES 2018-01-04 13:02:02 +01:00
Rodrigo Queiro
5b1aa94e4b
Merge pull request #276 from drigz/add-example
Add an example using glog from Bazel
2018-01-04 12:00:27 +01:00
Rodrigo Queiro
3efe9e4025 Add an example using glog from Bazel 2018-01-04 11:35:53 +01:00
Rodrigo Queiro
bffb4a6ee2
Merge pull request #277 from drigz/update-gflags
Update gflags to latest master
2018-01-04 11:29:54 +01:00
Sergiu Deitsch
a92e1d95c5 cmake: use gflags package config instead of a find module
This allows to avoid conflicts between third party gflags find modules floating
around. If a package provide a local version of gflags find module, clients
which locate glog will incorrectly use it. Another problem is a CMake error message
"cmake_policy PUSH without matching POP" in nested find_package calls. In summary,
we need to ensure to use the original gflags package config.
2018-01-04 02:38:42 +01:00
Sergiu Deitsch
b2c3afecaa cmake: ensure consumers do not overwrite the required policy 2018-01-02 23:36:51 +01:00
Sergiu Deitsch
ce197f26a5 removed obsolete vsprojects 2018-01-02 22:31:47 +01:00
Sergiu Deitsch
185ba48937 cmake: added a postfix for debug builds (closes #237)
This allows to deploy debug and release builds concurrently.
2018-01-02 14:38:37 +01:00
Sergiu Deitsch
f3bd836de4
Merge pull request #281 from sergiud/msvc-error-define
Fixed undeclared identifier error
2018-01-02 02:21:51 +01:00
Sergiu Deitsch
85d49f7a47 logging_unittest: fixed undeclared identifier error (fixes #267) 2018-01-02 02:18:00 +01:00
Shinichiro Hamaji
0a9f71036f
Merge pull request #278 from shinh/contrib
Update AUTHORS and CONTRIBUTORS for PR#232
2017-12-21 19:05:40 +09:00
Shinichiro Hamaji
4682134d59 Update AUTHORS and CONTRIBUTORS for PR#232 2017-12-20 17:27:27 +09:00
Rodrigo Queiro
2a593235ba Update gflags to latest master
This means that gflags no longer leaks config.h, so I had to fix a bug
in glog.bzl where config.h is generated at the wrong path.

I also switched to the best-practice for depending on git repositories,
ie using http_archive with a mirror.
2017-12-19 15:50:12 +01:00
Rodrigo Queiro
fc87161c96
Merge pull request #232 from qzmfranklin/bazel
Build with Bazel.
2017-12-18 10:20:57 +01:00
Zhongming Qu
389a7782e8 Remove the use of bind() from WORKSPACE. 2017-12-14 13:45:01 -08:00
Zhongming Qu
ea458f60b9 Remove an empty textual_hdrs field. 2017-12-14 01:03:19 -08:00
Zhongming Qu
e6e2e1372a Hide certain header files from the cc_library().
This commit addresses a few issues:

    1.  No longer leak config.h in a way similar to
            https://github.com/gflags/gflags/issues/233
        The solution of prefixing the path by 'glog_internal' is modified from
            https://github.com/gflags/gflags/issues/234

    2.  No longer expose internal headers.

    3.  Replace PACKAGE_NAME with native.package_name()

    4.  Uers can choose namespaces via the newly added 'namespace' keyword.

    5.  Replace glob with explicitly listing of files.

    6.  Make the genrules more compact using pythonic list construction.
2017-12-14 00:58:33 -08:00
Zhongming Qu
004fc8cb8e Can build with Bazel now 2017-12-14 00:58:33 -08:00
Zhongming Qu
921651e97c Build with Bazel. 2017-12-14 00:58:33 -08:00
Fumitoshi Ukai
2063b38708
Merge pull request #261 from pcc/fix3
Compute base addresses from program headers while reading /proc/self/maps.
2017-11-10 16:55:27 +09:00
Peter Collingbourne
c4d37a78cc Compute base addresses from program headers while reading /proc/self/maps.
We previously had logic to compute the base address from program
headers as part of symbolization. The problem is that we need a correct
base address earlier in order to adjust a PC into the image's address
space, as these addresses can appear in unsymbolized output.

There was previously an assumption that only the mapping that
was lowest in the address space did not need to be adjusted. This
assumption is not guaranteed (for example, the kernel may choose to
map an ET_DYN lowest) and in fact turned out to be wrong in binaries
linked with lld because the first mapping is read-only.

The solution is to move the program header reading logic into the
code that reads /proc/self/maps.

There is a change in semantics for clients that install a callback
using the InstallSymbolizeOpenObjectFileCallback function. Any such
clients will need to return a correct base address from the callback
by reading program headers using code similar to that in the function
OpenObjectFileContainingPcAndGetStartAddress.
2017-11-08 14:15:02 -08:00
Sergiu Deitsch
bac8811710
Merge pull request #106 from dimhotepus/master
Cache strlen outside of cycles (PVS-Studio)
2017-11-04 16:22:21 +01:00
Kenny Yu
4764ca65f5 Annotate LOG_EVERY_N macros as a benign race for TSAN
Summary:
Issue #80 points out several places in glog where TSAN discovers
false positives. One of these places is in the `LOG_EVERY_N` macros.
These macros are implemented by maintaining a static unprotected
integer counter, and TSAN will report data races on these counters.

Here is a minimum example to reproduce the data race:

```

void logging() {
  for (int i = 0; i < 300; ++i) {
    LOG_EVERY_N(INFO, 2) << "foo";
  }
}

int main() {
  auto t1 = std::thread(logging);
  auto t2 = std::thread(logging);
  t1.join();
  t2.join();
  return 0;
}
```

And here is the TSAN report:

```
WARNING: ThreadSanitizer: data race (pid=776850)
  Write of size 4 at 0x558de483f684 by thread T2:
    #0 logging()
    #1 void std::_Bind_simple<void (*())()>::_M_invoke<>(std::_Index_tuple<>)
    #2 std::_Bind_simple<void (*())()>::operator()()
    #3 std:🧵:_Impl<std::_Bind_simple<void (*())()> >::_M_run()
    #4 execute_native_thread_routine

  Previous write of size 4 at 0x558de483f684 by thread T1:
    #0 logging()
    #1 void std::_Bind_simple<void (*())()>::_M_invoke<>(std::_Index_tuple<>)
    #2 std::_Bind_simple<void (*())()>::operator()()
    #3 std:🧵:_Impl<std::_Bind_simple<void (*())()> >::_M_run()
    #4 execute_native_thread_routine

  Location is global '<null>' at 0x000000000000 (main+0x00000011c684)

  Thread T2 (tid=776857, running) created by main thread at:
    #0 pthread_create
    #1 __gthread_create
    #2 std:🧵:_M_start_thread(std::shared_ptr<std:🧵:_Impl_base>, void (*)())
    #3 main

  Thread T1 (tid=776856, running) created by main thread at:
    #0 pthread_create
    #1 __gthread_create
    #2 std:🧵:_M_start_thread(std::shared_ptr<std:🧵:_Impl_base>, void (*)())
    #3 main

SUMMARY: ThreadSanitizer: data race in logging()
```

To avoid noisy TSAN reports and also avoid adding a performance hit, this
change will mark these counters as benign races so that TSAN will not report
them. This change will only have an effect if we are compiling with TSAN;
there are no changes if we are not building with TSAN.

With this change, the above example no longer reports a data race when built
and run with TSAN.
2017-11-03 17:32:47 -07:00
Shinichiro Hamaji
d72e3be82c
Merge pull request #260 from ukai/shell_escape
Shell escape arguments to /bin/mail.
2017-10-31 14:30:52 +09:00
Fumitoshi Ukai
9f8a9a9a0d Shell escape arguments to /bin/mail. 2017-10-31 13:04:26 +09:00
Shinichiro Hamaji
56b81ea796 Style fixes for consistency 2017-10-20 16:11:31 +09:00
Shinichiro Hamaji
ebf81ac476 Merge pull request #245 from DariuszOstolski/issue211
Fix username lookup in case of missing USER environment variable
2017-10-20 16:09:28 +09:00