Skip to content

Commit cf58c73

Browse files
marsupiallgritz
authored andcommitted
Minor fixes - boost::wave whitespace issue and uninitialized variable (#840)
* Turn off Turn off whitespace insertion when using boost::wave. * Fix un-initialized members of ASTfunction_call. Move all initialization into constructor so some compilers can error on regression.
1 parent c505420 commit cf58c73

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/liboslcomp/ast.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,14 +1082,14 @@ ASTtype_constructor::childname (size_t i) const
10821082
ASTfunction_call::ASTfunction_call (OSLCompilerImpl *comp, ustring name,
10831083
ASTNode *args, FunctionSymbol *funcsym)
10841084
: ASTNode (function_call_node, comp, 0, args), m_name(name),
1085+
m_sym(funcsym ? funcsym : comp->symtab().find (name)), // Look it up.
1086+
m_poly(funcsym), // Default - resolved symbol or null
10851087
m_argread(~1), // Default - all args are read except the first
10861088
m_argwrite(1), // Default - first arg only is written by the op
10871089
m_argtakesderivs(0) // Default - doesn't take derivs
10881090
{
1089-
// If we weren't passed a function symbol directly, look it up.
1090-
m_sym = funcsym ? funcsym : comp->symtab().find (name);
10911091
if (! m_sym) {
1092-
error ("function '%s' was not declared in this scope", name.c_str());
1092+
error ("function '%s' was not declared in this scope", name);
10931093
// FIXME -- would be fun to troll through the symtab and try to
10941094
// find the things that almost matched and offer suggestions.
10951095
return;

src/liboslcomp/oslcomp.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,10 @@ OSLCompilerImpl::preprocess_buffer (const std::string &buffer,
204204
context_type ctx (instring.begin(), instring.end(), filename.c_str());
205205

206206
// Turn on support of variadic macros, e.g. #define FOO(...) __VA_ARGS__
207+
// Turn off whitespace insertion.
207208
boost::wave::language_support lang = boost::wave::language_support (
208-
ctx.get_language() | boost::wave::support_option_variadics);
209+
(ctx.get_language() | boost::wave::support_option_variadics)
210+
& ~boost::wave::language_support::support_option_insert_whitespace);
209211
ctx.set_language (lang);
210212

211213
ctx.add_macro_definition (OIIO::Strutil::format("OSL_VERSION_MAJOR=%d",

0 commit comments

Comments
 (0)