Skip to content

Commit ca34d29

Browse files
lgritzscott-wilson
authored andcommitted
api: Deprecations: missing_math.h, parmalist.h, parallel.h, strutil.h, sysutil.h, thread.h, tiffutils.h, ustring.h, type_traits.h (AcademySoftwareFoundation#4338)
* Remove long deprecated and empty header missing_math.h * paramlist.h: Deprecate the old form of ParamValue constructors. People should be using the versions with strongly typed params, not raw bools. * parallel.h: Remove deprecated parallel_for variants. * strutil.h: Add deprecation warnings to old-style format. * sysutil.h: Deprecate Sysutil::physical_concurrency. Also, I noticed that all the external declarations in this header were incorrectly OIIO_API but should have been OIIO_UTIL_API to reflect that they are in the OpenImageIO_Util library. * thread.h: mark deprecated yield() and this_thread_is_in_pool(). * tiffutils.h: removed deprecated redundant functions. * ustring.h: Remove deprecated ustringHash. * type_traits.h: Remove deprecated OIIO::void_t, use std::void_t instead. --------- Signed-off-by: Larry Gritz <lg@larrygritz.com> Signed-off-by: Scott Wilson <scott@propersquid.com>
1 parent 7f6c10b commit ca34d29

File tree

17 files changed

+77
-336
lines changed

17 files changed

+77
-336
lines changed

docs/Deprecations-3.0.md

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,33 @@ long-deprecated API facets. This document lists the deprecations and removals.
6767
severefmt, messagefmt, debugfmt, respectively, which all use the std::format
6868
notation.
6969

70+
## missingmath.h
7071

71-
# texture.h
72+
* This header has been removed entirely. It has was originally needed for
73+
pre-C++11 MSVS, but has been unused since OIIO 2.0 (other than transitively
74+
including fmath.h).
75+
76+
## parallel.h
77+
78+
* Removed several varieties of `parallel_for` functions where the task
79+
functions took a thread ID argument in addition to the range, which have
80+
been considered deprecated since OIIO 2.3. Please use task functions that do
81+
not take a thread ID parameter.
82+
83+
## paramlist.h
84+
85+
* Removed some ParamValue constructor variants that have been deprecated since
86+
OIIO 2.4. The removed variants took an optional `bool` parameter indicating
87+
whether the value was copied. If you need to override the usual copy
88+
behavior, please use the newer variety of constructors that instead use a
89+
"strong" type where you pass `ParamValue:Copy(bool)`.
90+
91+
## strutil.h
92+
93+
* Added deprecation warnings to all the old (printf-convention) string
94+
`format()` function.
95+
96+
## texture.h
7297

7398
* Removed stochastic-related tokens from the MipMode and InterpMode enums.
7499
These were originally experimental but never removed.
@@ -81,7 +106,28 @@ long-deprecated API facets. This document lists the deprecations and removals.
81106
on batches using the VaryingRef class. These were replaced by alternatives
82107
a long time ago.
83108

84-
# varyinref.h
109+
## thread.h
110+
111+
* `OIIO::yield()` now has a deprecation warning, having been marked as
112+
deprecatd since OIIO 2.4. Use `std::this_thread::yield()`.
113+
114+
## tiffutils.h
115+
116+
* Removed the version of decode_exif that takes a pointer and length
117+
(deprecated since 1.8). Use the version that takes a `string_view`, or the
118+
one that takes a `cspan<uint8_t>`.
119+
120+
## type_traits.h
121+
122+
* Removed the `OIIO::void_t` template, which now should be replaced with
123+
`std::void_t`.
124+
125+
## ustring.h
126+
127+
* Removed old `ustringHash` (which was just an alias for `std::hash<ustring>`,
128+
which should be used instead.
129+
130+
## varyingref.h
85131

86132
* This header has been removed completely, since we no longer use the classes
87133
it defines.

src/include/OpenImageIO/missing_math.h

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/include/OpenImageIO/parallel.h

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -297,75 +297,4 @@ parallel_for_2D(int64_t xbegin, int64_t xend, int64_t ybegin, int64_t yend,
297297

298298

299299

300-
#if OIIO_VERSION < OIIO_MAKE_VERSION(3, 0, 0)
301-
302-
// Deprecated versions of parallel loops where the task functions take a
303-
// thread ID in addition to the range. These are deprecated as of OIIO 2.3,
304-
// will warn about deprecation starting in OIIO 2.4, and will be removed
305-
// starting with OIIO 3.0.
306-
307-
// OIIO_DEPRECATED("Use tasks that don't take a thread ID (2.3)")
308-
OIIO_UTIL_API void
309-
parallel_for_chunked(int64_t begin, int64_t end, int64_t chunksize,
310-
std::function<void(int id, int64_t b, int64_t e)>&& task,
311-
paropt opt = paropt(0, paropt::SplitDir::Y, 1));
312-
313-
// OIIO_DEPRECATED("Use tasks that don't take a thread ID (2.3)")
314-
OIIO_UTIL_API void
315-
parallel_for(int64_t begin, int64_t end,
316-
std::function<void(int id, int64_t index)>&& task,
317-
paropt opt = paropt(0, paropt::SplitDir::Y, 1));
318-
319-
// OIIO_DEPRECATED("Use tasks that don't take a thread ID (2.3)")
320-
OIIO_UTIL_API void
321-
parallel_for_chunked_2D(
322-
int64_t xbegin, int64_t xend, int64_t xchunksize, int64_t ybegin,
323-
int64_t yend, int64_t ychunksize,
324-
std::function<void(int id, int64_t, int64_t, int64_t, int64_t)>&& task,
325-
paropt opt = 0);
326-
327-
// OIIO_DEPRECATED("Use tasks that don't take a thread ID (2.3)")
328-
inline void
329-
parallel_for_2D(int64_t xbegin, int64_t xend, int64_t ybegin, int64_t yend,
330-
std::function<void(int id, int64_t i, int64_t j)>&& task,
331-
paropt opt = 0)
332-
{
333-
parallel_for_chunked_2D(
334-
xbegin, xend, 0, ybegin, yend, 0,
335-
[&task](int id, int64_t xb, int64_t xe, int64_t yb, int64_t ye) {
336-
for (auto y = yb; y < ye; ++y)
337-
for (auto x = xb; x < xe; ++x)
338-
task(id, x, y);
339-
},
340-
opt);
341-
}
342-
343-
// Deprecated parallel_for_each. We never used it and I decided I didn't
344-
// like the implementation and didn't want its guts exposed any more. For
345-
// compatibility (just in case somebody has used it), implement it serially
346-
// so that it's correct, even if it's not fast. It will eventually be
347-
// removed.
348-
template<class InputIt, class UnaryFunction>
349-
// OIIO_DEPRECATED("Don't use this (2.3)")
350-
UnaryFunction
351-
parallel_for_each(InputIt begin, InputIt end, UnaryFunction f,
352-
paropt opt = paropt(0, paropt::SplitDir::Y, 1))
353-
{
354-
return std::for_each(begin, end, f);
355-
}
356-
357-
// DEPRECATED(1.8): This version accidentally accepted chunksizes that
358-
// weren't used. Preserve for a version to not break 3rd party apps.
359-
OIIO_DEPRECATED("Use the version without chunk sizes (1.8)")
360-
inline void
361-
parallel_for_2D(int64_t xbegin, int64_t xend, int64_t /*xchunksize*/,
362-
int64_t ybegin, int64_t yend, int64_t /*ychunksize*/,
363-
std::function<void(int id, int64_t i, int64_t j)>&& task)
364-
{
365-
parallel_for_2D(xbegin, xend, ybegin, yend, std::move(task));
366-
}
367-
368-
#endif /* Deprecated functions */
369-
370-
371300
OIIO_NAMESPACE_END

src/include/OpenImageIO/paramlist.h

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -90,31 +90,6 @@ class OIIO_UTIL_API ParamValue {
9090

9191
ParamValue() noexcept { m_data.ptr = nullptr; }
9292

93-
#if OIIO_VERSION_LESS(3, 0, 0) && !defined(OIIO_DOXYGEN)
94-
// DEPRECATED(2.4): Use the ones with strongly typed bool parameters
95-
ParamValue(const ustring& _name, TypeDesc _type, int _nvalues,
96-
const void* _value, bool _copy) noexcept
97-
{
98-
init_noclear(_name, _type, _nvalues, _value, Copy(_copy));
99-
}
100-
ParamValue(const ustring& _name, TypeDesc _type, int _nvalues,
101-
Interp _interp, const void* _value, bool _copy) noexcept
102-
{
103-
init_noclear(_name, _type, _nvalues, _interp, _value, Copy(_copy));
104-
}
105-
ParamValue(string_view _name, TypeDesc _type, int _nvalues,
106-
const void* _value, bool _copy) noexcept
107-
{
108-
init_noclear(ustring(_name), _type, _nvalues, _value, Copy(_copy));
109-
}
110-
ParamValue(string_view _name, TypeDesc _type, int _nvalues, Interp _interp,
111-
const void* _value, bool _copy) noexcept
112-
{
113-
init_noclear(ustring(_name), _type, _nvalues, _interp, _value,
114-
Copy(_copy));
115-
}
116-
#endif
117-
11893
ParamValue(const ustring& _name, TypeDesc _type, int _nvalues,
11994
const void* _value, Copy _copy = Copy(true)) noexcept
12095
{
@@ -187,31 +162,6 @@ class OIIO_UTIL_API ParamValue {
187162

188163
~ParamValue() noexcept { clear_value(); }
189164

190-
#if OIIO_VERSION_LESS(3, 0, 0) && !defined(OIIO_DOXYGEN)
191-
// DEPRECATED(2.4): Use the ones with strongly typed bool parameters
192-
void init(ustring _name, TypeDesc _type, int _nvalues, Interp _interp,
193-
const void* _value, bool _copy) noexcept
194-
{
195-
clear_value();
196-
init_noclear(_name, _type, _nvalues, _interp, _value, Copy(_copy));
197-
}
198-
void init(ustring _name, TypeDesc _type, int _nvalues, const void* _value,
199-
bool _copy) noexcept
200-
{
201-
init(_name, _type, _nvalues, INTERP_CONSTANT, _value, Copy(_copy));
202-
}
203-
void init(string_view _name, TypeDesc _type, int _nvalues,
204-
const void* _value, bool _copy) noexcept
205-
{
206-
init(ustring(_name), _type, _nvalues, _value, Copy(_copy));
207-
}
208-
void init(string_view _name, TypeDesc _type, int _nvalues, Interp _interp,
209-
const void* _value, bool _copy) noexcept
210-
{
211-
init(ustring(_name), _type, _nvalues, _interp, _value, Copy(_copy));
212-
}
213-
#endif
214-
215165
void init(ustring _name, TypeDesc _type, int _nvalues, Interp _interp,
216166
const void* _value, Copy _copy) noexcept
217167
{

src/include/OpenImageIO/strutil.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,7 @@
4141
# define OIIO_FORMAT_IS_FMT 0
4242
#endif
4343

44-
// If OIIO_HIDE_FORMAT is defined, mark the old-style format functions as
45-
// deprecated. (This is a debugging aid for downstream projects who want to
46-
// root out any places where they might be using the old one).
47-
#ifdef OIIO_HIDE_FORMAT
48-
# define OIIO_FORMAT_DEPRECATED OIIO_DEPRECATED("old style (printf-like) formatting version of this function is deprecated")
49-
#else
50-
# define OIIO_FORMAT_DEPRECATED
51-
#endif
44+
#define OIIO_FORMAT_DEPRECATED OIIO_DEPRECATED("old style (printf-like) formatting version of this function is deprecated")
5245

5346
// If OIIO_PRINT_IS_SYNCHRONIZED is not defined, assume unsynchronized.
5447
#ifndef OIIO_PRINT_IS_SYNCHRONIZED

src/include/OpenImageIO/sysutil.h

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,52 +44,48 @@ namespace Sysutil {
4444
/// (which can be misleading because gcc allocates quite a bit of
4545
/// virtual, but not actually resident until malloced, memory per
4646
/// thread).
47-
OIIO_API size_t
47+
OIIO_UTIL_API size_t
4848
memory_used(bool resident = true);
4949

5050
/// The amount of physical RAM on this machine, in bytes.
5151
/// If it can't figure it out, it will return 0.
52-
OIIO_API size_t
52+
OIIO_UTIL_API size_t
5353
physical_memory();
5454

5555
/// Convert calendar time pointed by 'time' into local time and save it in
5656
/// 'converted_time' variable. This is a fully reentrant/thread-safe
5757
/// alternative to the non-reentrant C localtime() call.
58-
OIIO_API void
58+
OIIO_UTIL_API void
5959
get_local_time(const time_t* time, struct tm* converted_time);
6060

6161
/// Return the full path of the currently-running executable program.
6262
///
63-
OIIO_API std::string
63+
OIIO_UTIL_API std::string
6464
this_program_path();
6565

6666
/// Return the value of an environment variable, or if it is not found in
6767
/// the environment, return `defaultval`, which in turn defaults to the
6868
/// empty string.
69-
OIIO_API string_view
70-
getenv(string_view name, string_view defaultval);
71-
72-
// Legacy for link compatibility. DEPRECATED(2.3)
73-
OIIO_API string_view
74-
getenv(string_view name);
69+
OIIO_UTIL_API string_view
70+
getenv(string_view name, string_view defaultval = {});
7571

7672
/// Sleep for the given number of microseconds.
7773
///
78-
OIIO_API void
74+
OIIO_UTIL_API void
7975
usleep(unsigned long useconds);
8076

8177
/// Try to put the process into the background so it doesn't continue to
8278
/// tie up any shell that it was launched from. The arguments are the
8379
/// argc/argv that describe the program and its command line arguments.
8480
/// Return true if successful, false if it was unable to do so.
85-
OIIO_API bool
81+
OIIO_UTIL_API bool
8682
put_in_background(int argc, char* argv[]);
8783

8884
/// Number of virtual cores available on this platform (including
8985
/// hyperthreads). Note that this is just a wrapper/synonym for C++
9086
/// std::thread::hardware_concurrency(), and was put in OIIO to allow its use
9187
/// before C++11 was our minimum.
92-
OIIO_API unsigned int
88+
OIIO_UTIL_API unsigned int
9389
hardware_concurrency();
9490

9591
#if OIIO_DISABLE_DEPRECATED < OIIO_MAKE_VERSION(2, 6, 0)
@@ -101,18 +97,21 @@ hardware_concurrency();
10197
/// release of OpenImageIO. It is now a synonym for hardware_concurrency().
10298
OIIO_DEPRECATED(
10399
"unreliable, replace with hardware_concurrency() [DEPRECATED in 2.6.0.0]")
104-
OIIO_API unsigned int
105-
physical_concurrency();
100+
inline unsigned int
101+
physical_concurrency()
102+
{
103+
return hardware_concurrency();
104+
}
106105
#endif
107106

108107
/// Get the maximum number of open file handles allowed on this system.
109-
OIIO_API size_t
108+
OIIO_UTIL_API size_t
110109
max_open_files();
111110

112111
/// Return a string containing a readable stack trace from the point where
113112
/// it was called. Return an empty string if not supported on this platform
114113
/// or this build of OpenImageIO.
115-
OIIO_API std::string
114+
OIIO_UTIL_API std::string
116115
stacktrace();
117116

118117
/// Turn on automatic stacktrace dump to the named file if the program
@@ -121,23 +120,23 @@ stacktrace();
121120
/// be "stdout" or "stderr" to merely print the trace to stdout or stderr,
122121
/// respectively. If the name is "", it will disable the auto-stacktrace
123122
/// printing.
124-
OIIO_API bool
123+
OIIO_UTIL_API bool
125124
setup_crash_stacktrace(string_view filename);
126125

127126
/// Try to figure out how many columns wide the terminal window is. May not
128127
/// be correct on all systems, will default to 80 if it can't figure it out.
129-
OIIO_API int
128+
OIIO_UTIL_API int
130129
terminal_columns();
131130

132131
/// Try to figure out how many rows tall the terminal window is. May not be
133132
/// correct on all systems, will default to 24 if it can't figure it out.
134-
OIIO_API int
133+
OIIO_UTIL_API int
135134
terminal_rows();
136135

137136

138137
/// Term object encapsulates information about terminal output for the sake
139138
/// of constructing ANSI escape sequences.
140-
class OIIO_API Term {
139+
class OIIO_UTIL_API Term {
141140
public:
142141
/// Default ctr: assume ANSI escape sequences are ok.
143142
Term() noexcept {}

src/include/OpenImageIO/thread.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ typedef std::lock_guard<std::recursive_timed_mutex> recursive_timed_lock_guard;
9090

9191
/// Yield the processor for the rest of the timeslice.
9292
/// DEPRECATED(2.4): Use std::this_thread::yield() instead.
93+
OIIO_DEPRECATED("Use std::this_thread::yield() [2.4]")
9394
inline void
9495
yield() noexcept
9596
{
@@ -725,6 +726,7 @@ class OIIO_UTIL_API thread_pool {
725726
/// can be used to limit a pool thread from unadvisedly adding its own
726727
/// subtasks to clog up the pool.
727728
/// DEPRECATED(2.1) -- use is_worker() instead.
729+
OIIO_DEPRECATED("use is_worker [2.1]")
728730
bool this_thread_is_in_pool() const;
729731

730732
/// Register a thread (not already in the thread pool itself) as working
@@ -737,8 +739,6 @@ class OIIO_UTIL_API thread_pool {
737739
/// the pool?
738740
bool is_worker(std::thread::id id) const;
739741
bool is_worker() const { return is_worker(std::this_thread::get_id()); }
740-
// Non-const versions: DEPRECATED(2.1)
741-
bool is_worker(std::thread::id id);
742742

743743
/// How many jobs are waiting to run? (Use with caution! Can be out of
744744
/// date by the time you look at it.)

0 commit comments

Comments
 (0)