# Relaxing script section is empty warning

This topic is 1451 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have a use-case for a script like so:

// scriptA.as

#include scriptB.as
#include scriptC.as


My preprocessor encounters each #include line and calls AddScriptSection with the source of each of those files (e.g. AddScriptSection("scriptB.as"), followed by AddScriptSection("scriptC.as"), then replaces each line with a newline in scriptA.as (since the compiler wouldn't compile an actual #include line).

When I call AddScriptSection("scriptA.as") with what looks like the following for the source:

// scriptA.as



it gives me a warning about an empty script section.

It's not trivial to attempt to detect that this script section is indeed empty (before calling the final AddScriptSection()) as it would involve parsing for comments.. you can't just check whether the string is all empty/newlines.

Do you think it would be feasible to silently soft-fail on an AddScriptSection() with an empty source if the module already has other source (e.g. in other script sections added previously)? Perhaps as an engine option?

Thank you for any tips!

Edited by iraxef

##### Share on other sites
I'll look into this. Perhaps only warning about empty sections if all are empty might be better as you suggested.

The warning was added because there were a couple of developers that accidentally tried to compile empty sections and obviously the result wasn't what they expected. So rather than giving an error when the application couldn't find the expected function or class, which may not be too clear about why the function or class is missing, I felt it better to give a warning when the section was empty.

##### Share on other sites

I've removed this compiler warning in revision 2097.

Thanks,

Andreas

1. 1
2. 2
Rutin
21
3. 3
4. 4
A4L
15
5. 5
khawk
14

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633737
• Total Posts
3013609
×