Commit Graph

5 Commits (02568074170f0725196de4e52450db024cc39895)

Author SHA1 Message Date
nirenjan 0256807417 Use strrchr only if the compiler supports __builtin_strrchr 2021-08-25 14:16:53 -07:00
nirenjan 204aadead0 Use __builtin_strrchr to get file base name
Prior to this change, pinelog used __FILE__ in the backtrace call.
However, this has a limitation that if used in a build system with
sources in subdirectories and/or a separate build directory, the
relative path to the file is used, giving us a backtrace like this.

    ../../daemon/x52d_main.c:51

This change checks if the compiler supports the __builtin_strrchr to
compute the file basename at compile time. If the compiler does not
support it, it falls back to using __FILE__ directly. This should not be
an issue on a modern compiler like gcc or clang.
2021-08-25 12:11:53 -07:00
nirenjan a3eb2c03d7 Add method to close output stream and reset to default 2021-07-16 08:29:11 -07:00
nirenjan fb9b51a130 Fix format-literal error in clang 2021-07-15 18:31:01 -07:00
nirenjan 10941defb2 Add test framework 2021-07-14 11:00:44 -07:00