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

More conversion of internals to std::format style, bit by bit #1493

Merged
merged 1 commit into from
May 4, 2022
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
31 changes: 0 additions & 31 deletions src/liboslcomp/ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,37 +201,6 @@ class ASTNode : public OIIO::RefCnt {

void sourceline(int line) { m_sourceline = line; }

template<typename... Args>
void errorf(const char* format, const Args&... args) const
{
OSL_DASSERT(format && format[0]);
error_impl(OIIO::Strutil::sprintf(format, args...));
}

/// Warning reporting
template<typename... Args>
void warningf(const char* format, const Args&... args) const
{
OSL_DASSERT(format && format[0]);
warning_impl(OIIO::Strutil::sprintf(format, args...));
}

/// info reporting
template<typename... Args>
void infof(const char* format, const Args&... args) const
{
OSL_DASSERT(format && format[0]);
info_impl(OIIO::Strutil::sprintf(format, args...));
}

/// message reporting
template<typename... Args>
void messagef(const char* format, const Args&... args) const
{
OSL_DASSERT(format && format[0]);
message_impl(OIIO::Strutil::sprintf(format, args...));
}

template<typename... Args>
void errorfmt(const char* format, const Args&... args) const
{
Expand Down
71 changes: 0 additions & 71 deletions src/liboslcomp/oslcomp_pvt.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,77 +75,6 @@ class OSLCompilerImpl {

ErrorHandler& errhandler() const { return *m_errhandler; }

/// Error reporting
template<typename... Args>
OIIO_DEPRECATED("use errorfmt")
void errorf(ustring filename, int line, const char* format,
const Args&... args) const
{
OSL_DASSERT(format && format[0]);
std::string msg = OIIO::Strutil::sprintf(format, args...);
if (msg.size() && msg.back() == '\n') // trim extra newline
msg.pop_back();
if (filename.size())
m_errhandler->errorfmt("{}:{}: error: {}", filename, line, msg);
else
m_errhandler->errorfmt("error: {}", msg);
m_err = true;
}

/// Warning reporting
template<typename... Args>
OIIO_DEPRECATED("use warningfmt")
void warningf(ustring filename, int line, const char* format,
const Args&... args) const
{
OSL_DASSERT(format && format[0]);
if (nowarn(filename, line))
return; // skip if the filename/line is on the nowarn list
std::string msg = OIIO::Strutil::sprintf(format, args...);
if (msg.size() && msg.back() == '\n') // trim extra newline
msg.pop_back();
if (m_err_on_warning) {
errorfmt(filename, line, "{}", msg);
return;
}
if (filename.size())
m_errhandler->warningfmt("{}:{}: warning: {}", filename, line, msg);
else
m_errhandler->warningfmt("warning: {}", msg);
}

/// Info reporting
template<typename... Args>
OIIO_DEPRECATED("use infofmt")
void infof(ustring filename, int line, const char* format,
const Args&... args) const
{
OSL_DASSERT(format && format[0]);
std::string msg = OIIO::Strutil::sprintf(format, args...);
if (msg.size() && msg.back() == '\n') // trim extra newline
msg.pop_back();
if (filename.size())
m_errhandler->infofmt("{}:{}: info: {}", filename, line, msg);
else
m_errhandler->infofmt("info: {}", msg);
}

/// message reporting
template<typename... Args>
OIIO_DEPRECATED("use messagef")
void messagef(ustring filename, int line, const char* format,
const Args&... args) const
{
OSL_DASSERT(format && format[0]);
std::string msg = OIIO::Strutil::sprintf(format, args...);
if (msg.size() && msg.back() == '\n') // trim extra newline
msg.pop_back();
if (filename.size())
m_errhandler->messagefmt("{}:{}: {}", filename, line, msg);
else
m_errhandler->messagefmt("{}", msg);
}

/// Error reporting
template<typename... Args>
void errorfmt(ustring filename, int line, const char* format,
Expand Down
Loading