Commit Graph

164 Commits

Author SHA1 Message Date
Victor Zverovich
48327a82e3 Make format.h compile faster 2022-09-01 17:06:47 -07:00
Victor Zverovich
64e29893cf Improve locale support 2022-09-01 14:48:43 -07:00
agga
ba50c19e82 use qualified call to avoid ADL conflict with std::format_to 2022-06-01 15:57:15 -07:00
Victor Zverovich
d1026fa5d2 Remove extern format_float 2022-05-29 13:11:19 -07:00
Victor Zverovich
ce246aaf74 Remove deprecated APIs 2022-05-22 07:10:09 -07:00
Victor Zverovich
496aff7c33 Remove deprecated APIs 2022-05-21 15:12:38 -07:00
Victor Zverovich
3c61799fbf Cleanup fuzzing mode 2022-03-18 12:01:52 -07:00
Victor Zverovich
c076a54a4d Move snprintf_float to format.h 2022-03-18 08:31:31 -07:00
Andreas Rogge
ae1aaaee5f
Fix access mode of files created (#2530) (#2733)
The previous fix for this in 4a85db1 was incomplete. The intent was to
mimic what `fopen()` is doing. As per standard[1] `fopen()` also sets
`S_IWGRP` and `S_IWOTH` and lets the umask handle the rest.

[1] https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/functions/fopen.html
2022-01-28 17:12:49 -08:00
Victor Zverovich
c28500556a FMT_NOEXCEPT -> noexcept 2022-01-20 16:55:47 -08:00
Victor Zverovich
713c7c7c62 Cleanup os.cc 2021-12-01 06:47:41 -08:00
Acretock
9b1807a8a2
fix int -> uint warning (#2611)
* fix int -> uint warning

* change unsigned int to mode_t

* undef + warn uint -> ushort loss presision

* fix mode_t

* mode_t in detail

Co-authored-by: Acretock <George.Goncharov@finch-xr.com>
2021-12-01 06:40:17 -08:00
Florin Iucha
acad8cfab1 Reformat all source code; no functional changes
Before adding the format checker, the mainline should be clean, to
avoid false failures.
2021-11-25 09:15:25 -08:00
Victor Zverovich
4a85db1ce1 Change default open mode to -rw-r--r-- (#2530) 2021-10-03 06:36:40 -07:00
Victor Zverovich
3d0c7ae385 Move data to format.cc 2021-09-13 06:23:57 -07:00
Victor Zverovich
3e7a29cc92 Workaround clang/gcc incompatibility 2021-07-02 13:29:22 -07:00
Daniela Engert
0193e7c428 Support compile-time strings and compile-time format string compilation in module
Make just the necessary parts available for lookup from client context.
2021-06-11 09:38:53 -07:00
Victor Zverovich
f4c95f6dd9 Improve handling of thousands separator 2021-06-03 18:25:08 -07:00
Daniela Engert
70e67ae018 Re-enable module testing
Prepare for compilation with gcc (modules branch).
2021-06-01 14:49:56 -07:00
Victor Zverovich
ff37e41625 wchar.h -> xchar.h because it handles other code unit types too 2021-05-29 09:37:17 -07:00
Daniela Engert
b99c2bd345 Remove deprecated locale.h from module interface unit 2021-05-23 06:17:25 -07:00
Victor Zverovich
34b8acaef7 More wchar_t-specific API to wchar.h 2021-05-21 18:24:39 -07:00
Daniela Engert
6e2e6b796f Restore support for wchar_t overloads in module 2021-05-20 10:03:58 -07:00
Victor Zverovich
61b4c923d7 Reduce code bloat 2021-05-20 05:51:45 -07:00
Sergiu Deitsch
13e652939b export missed symbols
Enable `-fvisibility=hidden` and `-fvisibility-inlines-hidden` by default in CI builds to ensure all public symbols are exported correctly.
2021-05-19 16:03:45 -07:00
Jussi Viiri
0763d8cadf Fix Visual Studio warning 2021-05-15 17:13:15 -07:00
Daniela Engert
5466373a11 Do *not* export namespace detail
Introduce `FMT_BEGIN_DETAIL_NAMESPACE` and `FMT_END_DETAIL_NAMESPACE` for `namespace detail` sections embedded in that part of the code that contains all declarations that are exported from the module, i.e. which is enclosed by `FMT_MODULE_EXPORT_BEGIN` and `FMT_MODULE_EXPORT_END`. Given a correct implementation of C++20 modules, neither the name `fmt::detail` nor any of its contents will become visible outside of the module.
2021-05-15 12:08:42 -07:00
Daniela Engert
9648bdce30 add missing header 2021-05-13 05:39:18 -07:00
Владислав Щапов
0036a1d195 Fix issue #2274. 2021-05-10 15:57:23 -07:00
Владислав Щапов
2a9b314627 Replace fmt::error_code to std::error_code 2021-05-09 12:26:19 -07:00
Victor Zverovich
16f2ef91ab Replace fmt::system_error with std::system_error 2021-05-07 08:33:39 -07:00
Victor Zverovich
4b885c8633 Replace windows_error with system_error 2021-05-07 06:19:03 -07:00
Victor Zverovich
ed7c4320f6 Cleanup tests 2021-05-02 09:28:38 -07:00
Daniela Engert
dacd1356e4 Add module interface unit 2021-04-24 06:39:57 -07:00
Victor Zverovich
c47f211296 Simplify data handling 2021-04-23 06:52:10 -07:00
denchat
52bd62c72f
Create separate dllexport marking points for clang and msvc. (#2229)
* add FMT_INSTANTIATION_DEF_API for msvc

This should fix https://github.com/fmtlib/fmt/issues/2228

To fix difference dllexport requirements
msvc:  dllexport at template instantiation definition in format.cc
clang: dllexport at template instantiation declaration (extern template) in format.h
2021-04-16 12:34:18 -07:00
Victor Zverovich
a1c6bfd77b Add a link to llvm diff 2021-04-12 10:05:14 -07:00
denchat
42eccac454
Fix clang warning about ignoring __declspec(dllexport) on basic_data<void> template instantitation definition (#2220) 2021-04-12 09:31:44 -07:00
Victor Zverovich
6d14f78115 Fix linkage errors when linking with a shared library (#2011) 2020-11-12 06:11:17 -08:00
Victor Zverovich
4081b2fe94 Fix ABI compatibility (#1961) 2020-10-29 11:29:47 -07:00
Victor Zverovich
cb224ecaa3 Instantiate to_decimal to make gcc lto happy (#1955) 2020-10-27 07:46:40 -07:00
Victor Zverovich
7446818f98 Simplify vformat_to 2020-10-21 07:15:11 -07:00
Victor Zverovich
e57ec7d563 Merge vformat_to overloads 2020-10-20 17:39:50 -07:00
darklukee
74654c8cbb
Fix compilation for systems without fcntl.h (#1942)
Co-authored-by: darklukee <no-reply@hidden>
2020-10-19 07:43:06 -07:00
Victor Zverovich
92a448a071 Apply clang-format 2020-08-19 10:42:22 -07:00
Victor Zverovich
ea76933802 Simplify ostream 2020-08-04 20:11:43 -07:00
Victor Zverovich
7c4c5c79d2 Make buffer size configurable 2020-08-01 10:53:58 -07:00
Victor Zverovich
415cd51913 direct_buffered_file -> ostream 2020-07-11 17:29:17 -07:00
Victor Zverovich
a2c4fed981 Double buffering no more 2020-07-10 20:35:14 -07:00
Victor Zverovich
fbf3b943cc Workaround a bug in gcc 2020-07-07 06:06:50 -07:00
Victor Zverovich
6732ea5000 Make symbols readable 2020-06-07 07:49:11 -07:00
Lucian Petrut
51bf9cfacb Fix Mingw support
If the ``_POSIX_`` flag is set, _fdopen will not be defined by
Mingw headers, which is addressed by this commit.

For what is worth, as opposed to ``fdopen``, ``_pipe`` *will*
actually have the ``_`` prefix when ``_POSIX_`` is set.
2020-05-26 06:39:22 -07:00
Victor Zverovich
8069265373 internal -> detail (#1538) 2020-05-10 07:34:30 -07:00
Victor Zverovich
de290f5c4c Ditch internal::arg_map 2020-05-09 12:43:11 -07:00
Victor Zverovich
2f05054dd3 Purge basic_writer 2020-05-07 11:35:41 -07:00
Victor Zverovich
59fe455f36 Remove compatibility stubs 2020-05-06 07:31:35 -07:00
asraa
e2ff910675
Replace FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION with fmt-specific macro (#1650)
Signed-off-by: Asra Ali <asraa@google.com>
2020-04-29 09:12:43 -07:00
Victor Zverovich
5944fcad37 Remove remaining wchar_t instantiation 2020-04-19 16:48:15 -07:00
Victor Zverovich
538d83fd08 Cleanup named arguments 2020-04-15 06:28:41 -07:00
Victor Zverovich
8a4630686e Improve handling of named arguments 2020-04-14 11:56:55 -07:00
Victor Zverovich
5899267c47 Fix a clang-tidy warning 2020-04-12 08:27:39 -07:00
gabime
3cd5179f32 Fixed clang tidy warning -multiple declarations in a single statement reduces readability 2020-04-12 06:29:09 -07:00
gabime
7404e33a73 Fix clang warning about explicit ctor 2020-04-12 06:19:16 -07:00
Victor Zverovich
f733882b55 Remove misleading FMT_USE_WINDOWS_H 2020-02-14 14:09:27 +01:00
Milian Wolff
314e15001f
Fix symbol visibility on Linux when compiling with -fvisibility=hidden (#1535)
Make FMT_API symbols use the default visibility on non-Windows
platforms. Otherwise, one cannot use the generated fmt library when
compiling globally with -fvisibility=hidden.

Fixes compile errors like:

```
../3rdParty/fmt/include/fmt/core.h:757: error: undefined reference to 'fmt::v6::internal::assert_fail(char const*, int, char const*)'
```

Note that the symbol exists, but is local:

```
$ nm -C libfmtd.so.6.1.3  | grep assert_fail
                 U __assert_fail
0000000000233ffa t fmt::v6::internal::assert_fail(char const*, int, char const*)
```

With this patch, the compile error is gone and the symbol is properly
exported:

```
$ nm -a bin/libfmtd.so -C | grep assert_fail
                 U __assert_fail
00000000002366ba T fmt::v6::internal::assert_fail(char const*, int, char const*)
```

Change-Id: I96054e622d9a2ae81907e1b01a1033e629767a91
2020-01-30 06:26:18 -08:00
dspc-douglas
9fc4161f5e fix interal compiler error when building with mingw 2020-01-22 18:14:46 -08:00
Victor Zverovich
da2569827e posix.cc -> os.cc 2019-12-15 12:36:15 -08:00
Victor Zverovich
35959a31d7 Move OS-specific APIs to a separate header 2019-12-15 11:46:45 -08:00
Victor Zverovich
ae7c50185d Reintroduce sprintf_format for ABI compatibility 2019-12-10 20:44:08 -08:00
Victor Zverovich
62da1db62a Avoid wchar_t instantiations 2019-12-01 07:34:09 -08:00
Victor Zverovich
c68703c9f4 float_spec -> float_specs 2019-11-26 15:53:24 -08:00
Victor Zverovich
8877a67724 Instantiate snprintf_float 2019-11-24 08:57:39 -08:00
Victor Zverovich
4cf59ce734 Integrate Grisu and sprintf digit generators 2019-11-23 06:56:29 -08:00
Victor Zverovich
7395472dde Refactor floating-point formatting 2019-11-22 18:49:19 -08:00
Victor Zverovich
ded1e7679e Refactor floating point formatting 2019-11-22 08:22:22 -08:00
Victor Zverovich
dcde089b4e Improve POSIX API detection 2019-11-15 07:28:02 -08:00
daniel
f1559e1d56 Use grouping() from locale for specifier 'n' 2019-11-05 07:22:12 +00:00
Rosen Penev
200ee6f108 Fix minor clang-tidy warnings
using instead of typedef.

climits instead of limits.h

Added missing cast to size_t.
2019-08-31 07:02:21 -07:00
Victor Zverovich
79209598f5 core_format_specs -> sprintf_specs 2019-07-07 06:54:25 -07:00
Victor Zverovich
1d3e3d8c04 Make the 'n' format specifier work with grisu disabled 2019-07-04 15:15:14 -07:00
Victor Zverovich
bc14c6ee20 Use the decimal point from locale 2019-07-03 17:55:00 -07:00
Victor Zverovich
d07cc2026b FMT_EXPLICIT -> explicit, FMT_NULL -> nullptr 2019-05-30 07:42:36 -07:00
denchat
29c10fbf6e Fix DLL visibility of explicit instantiation "declaration" of internal::basic_data<void> in header format.h and the explicit instantiation "definition" in format.cc (#1134)
* Update format.cc

As the explicit instantiation *declaration* of `internal::basic_data<void>` in format.h, this explicit instantiation *definition* should mirror FMT_API also.

* Mirror visibility of explicit instantiation declaration 

explicit instantiation declaration of internal::basic_data<void> should mirror visibility of FMT_API

* Eliminate `__declspec(dllexport)` designation on extern template internal::basic_data<> when `extern` affected during exporting phase.

* Add `FMT_EXTERN_TEMPLATE_API` for designate DLL export `extern template`

When exporting DLL, do not designate `__declspec(dllexport)` any template that has any explicit class template declaration a.k.a. `extern template`. Instead, designate `__declspec(dllexport)` at single point where we have explicit class template definition a.k.a. normal instantiation without `extern`

Note: this is a c++11 feature.

* Delete whole `FMT_USE_EXTERN_TEMPLATES` block and its condition

1. Remove whole `FMT_USE_EXTERN_TEMPLATES` block
(trailing `FMT_UDL_TEMPLATE` block)
````
#ifndef FMT_USE_EXTERN_TEMPLATES
#  ifndef FMT_HEADER_ONLY
#    define FMT_USE_EXTERN_TEMPLATES                           \
      ((FMT_CLANG_VERSION >= 209 && __cplusplus >= 201103L) || \
       (FMT_GCC_VERSION >= 303 && FMT_HAS_GXX_CXX11))
#  else
#    define FMT_USE_EXTERN_TEMPLATES 0
#  endif
#endif
````

2. Delete `FMT_USE_EXTERN_TEMPLATES` condition, only condition, that trailing basic_data class template definition.
````
#if FMT_USE_EXTERN_TEMPLATES
extern template struct basic_data<void>;
#endif
````

3. Replace `FMT_API` with new `FMT_EXTERN_TEMPLATE_API` added in `core.h` for sake of extern template of `basic_data<void>`

* Add `#define FMT_EXTERN extern` only when not `FMT_HEADER_ONLY`

* Replace `extern` on basic_data<void> with the `FMT_EXTERN` condition in core.h

* replace misspelled if !define() with ifndef
2019-05-02 07:49:01 -07:00
Victor Zverovich
8d8ea21c69 Partially implement Grisu3 2019-04-27 12:17:21 -07:00
Victor Zverovich
dc94010fa5 Remove char_traits (#1117) 2019-04-16 17:08:24 -07:00
Victor Zverovich
2808395481 basic_buffer -> buffer
This reduces symbol sizes and gets rid of shadowing warnings.
2019-04-07 20:32:28 -07:00
Victor Zverovich
a97757736b Use grisu for fixed precision 2019-02-23 15:50:50 -10:00
Victor Zverovich
8af651be39 Implement fixed precision 2019-02-22 10:47:27 -10:00
Victor Zverovich
5a314a5288 Eliminate extra copy on floating-point formatting 2019-02-06 10:17:50 -08:00
Victor Zverovich
4f6fda558c Add a grisu test stub 2019-01-27 10:10:13 -08:00
Victor Zverovich
fdd8e333c1 Fix compilation with locales disabled (#1011) 2019-01-19 07:16:05 -08:00
Victor Zverovich
58b6f8db48 Format the code using clang-format 2019-01-13 06:58:20 -08:00
Victor Zverovich
322b2594e0 Implement more time specifiers 2018-11-30 09:25:18 -08:00
Andreas Schönle
33fbb3a7eb Fix remaining linker errors. 2018-11-20 07:01:21 -08:00
Andreas Schönle
702b3d1618 Fix link error in windows with shared library. 2018-11-20 07:01:21 -08:00
Victor Zverovich
f2ee988105 Improve locale support 2018-11-14 12:07:39 -08:00
Victor Zverovich
324eac1aa5 Make locales work with any character type 2018-10-28 09:03:27 -07:00
Victor Zverovich
61e6d2e38c Fix core version of vformat_to 2018-10-25 06:21:41 -07:00
Victor Zverovich
486fff597c Add sprintf_format instantiations and remove syntactic noise 2018-10-24 16:46:32 -07:00
superfunc
939fbe5567 Remove basic_fixed_buffer.
Issue #873 indicates that this class is no longer required,
as it has been superseded by a new API.

Fixes #873
2018-10-09 06:51:01 -07:00