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

Add missing info and message reporting methods to ASTNode and OSLCompilerImpl #854

Merged
merged 1 commit into from
Feb 5, 2018

Conversation

lgritz
Copy link
Collaborator

@lgritz lgritz commented Feb 3, 2018

No description provided.

@lgritz lgritz mentioned this pull request Feb 3, 2018
5 tasks
@marsupial
Copy link
Contributor

Not for nothing but might be worth refactoring all the redundant / boilerplate string formatting, ifdef, and assertions of info, message, warning, error routines to forward into one common function?

ast.h

  template<typename... Args>
  void show_message (int type, string_view format, const Args&... args) const {
        DASSERT (format.size());
#if OIIO_VERSION >= 10803
        show_message (type, OIIO::Strutil::format (format, args...));
#else /* DEPRECATE when OIIO minimum is at least 1.8 */
        show_message (type, OIIO::Strutil::format (format.c_str(), args...));
#endif
  }

  template<typename... Args>
  void error (string_view format, const Args&... args) const {
    show_message(0, format, std::forward<Args>(args)...);
  }

  template<typename... Args>
  void warning (string_view format, const Args&... args) const {
    show_message(1, format, std::forward<Args>(args)...);
  }

ast.cpp

void ASTNode::show_message(int type, string_view msg) {
 if (type == 0) m_compiler->error();
 else if (type == 1) m_compiler->warning();
 else if (type == 2) m_compiler->info();
 else if (type == 3) m_compiler->message();
}

@lgritz
Copy link
Collaborator Author

lgritz commented Feb 3, 2018

I will need to refactor anyway when I bump up the OIIO version floor, to declutter these functions, will think about it then.

@lgritz lgritz merged commit 5a5766f into AcademySoftwareFoundation:master Feb 5, 2018
@lgritz lgritz deleted the lg-compmessage branch February 7, 2018 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants