From 6c2649b51a7f0bfb814641896d79cf30b8518f45 Mon Sep 17 00:00:00 2001 From: Frederich Munch Date: Tue, 19 Dec 2017 15:34:31 -0500 Subject: [PATCH 1/2] Turn off Turn off whitespace insertion when using boost::wave. --- src/liboslcomp/oslcomp.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/liboslcomp/oslcomp.cpp b/src/liboslcomp/oslcomp.cpp index 540b1e811..72c55d88d 100644 --- a/src/liboslcomp/oslcomp.cpp +++ b/src/liboslcomp/oslcomp.cpp @@ -204,8 +204,10 @@ OSLCompilerImpl::preprocess_buffer (const std::string &buffer, context_type ctx (instring.begin(), instring.end(), filename.c_str()); // Turn on support of variadic macros, e.g. #define FOO(...) __VA_ARGS__ + // Turn off whitespace insertion. boost::wave::language_support lang = boost::wave::language_support ( - ctx.get_language() | boost::wave::support_option_variadics); + (ctx.get_language() | boost::wave::support_option_variadics) + & ~boost::wave::language_support::support_option_insert_whitespace); ctx.set_language (lang); ctx.add_macro_definition (OIIO::Strutil::format("OSL_VERSION_MAJOR=%d", From be57edf6fa99d01c6678154794c49e2155379a9c Mon Sep 17 00:00:00 2001 From: Frederich Munch Date: Fri, 22 Dec 2017 13:00:00 -0500 Subject: [PATCH 2/2] Fix un-initialized members of ASTfunction_call. Move all initialization into constructor so some compilers can error on regression. --- src/liboslcomp/ast.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/liboslcomp/ast.cpp b/src/liboslcomp/ast.cpp index b781df90b..42b1b3c85 100644 --- a/src/liboslcomp/ast.cpp +++ b/src/liboslcomp/ast.cpp @@ -1025,14 +1025,14 @@ ASTtype_constructor::childname (size_t i) const ASTfunction_call::ASTfunction_call (OSLCompilerImpl *comp, ustring name, ASTNode *args, FunctionSymbol *funcsym) : ASTNode (function_call_node, comp, 0, args), m_name(name), + m_sym(funcsym ? funcsym : comp->symtab().find (name)), // Look it up. + m_poly(funcsym), // Default - resolved symbol or null m_argread(~1), // Default - all args are read except the first m_argwrite(1), // Default - first arg only is written by the op m_argtakesderivs(0) // Default - doesn't take derivs { - // If we weren't passed a function symbol directly, look it up. - m_sym = funcsym ? funcsym : comp->symtab().find (name); if (! m_sym) { - error ("function '%s' was not declared in this scope", name.c_str()); + error ("function '%s' was not declared in this scope", name); // FIXME -- would be fun to troll through the symtab and try to // find the things that almost matched and offer suggestions. return;