Add column to location logs
This option can be enabled using the new --error-column option to the command line utility. It can also be enabled programatically.
This commit is contained in:
parent
52f68dc6b2
commit
dc9f6f61ad
11 changed files with 77 additions and 11 deletions
|
|
@ -205,7 +205,9 @@ static int c_shader_messages(glslang_messages_t messages)
|
|||
CONVERT_MSG(GLSLANG_MSG_HLSL_LEGALIZATION_BIT, EShMsgHlslLegalization);
|
||||
CONVERT_MSG(GLSLANG_MSG_HLSL_DX9_COMPATIBLE_BIT, EShMsgHlslDX9Compatible);
|
||||
CONVERT_MSG(GLSLANG_MSG_BUILTIN_SYMBOL_TABLE_BIT, EShMsgBuiltinSymbolTable);
|
||||
CONVERT_MSG(GLSLANG_MSG_ENHANCED, EShMsgEnhanced);
|
||||
CONVERT_MSG(GLSLANG_MSG_ABSOLUTE_PATH, EShMsgAbsolutePath);
|
||||
CONVERT_MSG(GLSLANG_MSG_DISPLAY_ERROR_COLUMN, EShMsgDisplayErrorColumn);
|
||||
return res;
|
||||
#undef CONVERT_MSG
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,10 +95,14 @@ public:
|
|||
default: append("UNKNOWN ERROR: "); break;
|
||||
}
|
||||
}
|
||||
void location(const TSourceLoc& loc, bool absolute = false) {
|
||||
void location(const TSourceLoc& loc, bool absolute = false, bool displayColumn = false) {
|
||||
const int maxSize = 24;
|
||||
char locText[maxSize];
|
||||
snprintf(locText, maxSize, ":%d", loc.line);
|
||||
if (displayColumn) {
|
||||
snprintf(locText, maxSize, ":%d:%d", loc.line, loc.column);
|
||||
} else {
|
||||
snprintf(locText, maxSize, ":%d", loc.line);
|
||||
}
|
||||
|
||||
if(loc.getFilename() == nullptr && shaderFileName != nullptr && absolute) {
|
||||
append(std::filesystem::absolute(shaderFileName).string());
|
||||
|
|
@ -119,9 +123,11 @@ public:
|
|||
append(s);
|
||||
append("\n");
|
||||
}
|
||||
void message(TPrefixType message, const char* s, const TSourceLoc& loc) {
|
||||
void message(TPrefixType message, const char* s, const TSourceLoc& loc, bool absolute = false,
|
||||
bool displayColumn = false)
|
||||
{
|
||||
prefix(message);
|
||||
location(loc);
|
||||
location(loc, absolute, displayColumn);
|
||||
append(s);
|
||||
append("\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,6 +175,7 @@ typedef enum {
|
|||
GLSLANG_MSG_BUILTIN_SYMBOL_TABLE_BIT = (1 << 14),
|
||||
GLSLANG_MSG_ENHANCED = (1 << 15),
|
||||
GLSLANG_MSG_ABSOLUTE_PATH = (1 << 16),
|
||||
GLSLANG_MSG_DISPLAY_ERROR_COLUMN = (1 << 17),
|
||||
LAST_ELEMENT_MARKER(GLSLANG_MSG_COUNT),
|
||||
} glslang_messages_t;
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ void TParseContextBase::outputMessage(const TSourceLoc& loc, const char* szReaso
|
|||
safe_vsprintf(szExtraInfo, maxSize, szExtraInfoFormat, args);
|
||||
|
||||
infoSink.info.prefix(prefix);
|
||||
infoSink.info.location(loc, messages & EShMsgAbsolutePath);
|
||||
infoSink.info.location(loc, messages & EShMsgAbsolutePath, messages & EShMsgDisplayErrorColumn);
|
||||
infoSink.info << "'" << szToken << "' : " << szReason << " " << szExtraInfo << "\n";
|
||||
|
||||
if (prefix == EPrefixError) {
|
||||
|
|
|
|||
|
|
@ -775,7 +775,7 @@ void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int
|
|||
for (int i = 0; i < numExtensions; ++i) {
|
||||
switch (getExtensionBehavior(extensions[i])) {
|
||||
case EBhWarn:
|
||||
infoSink.info.message(EPrefixWarning, ("extension " + TString(extensions[i]) + " is being used for " + featureDesc).c_str(), loc);
|
||||
infoSink.info.message(EPrefixWarning, ("extension " + TString(extensions[i]) + " is being used for " + featureDesc).c_str(), loc, messages & EShMsgAbsolutePath, messages & EShMsgDisplayErrorColumn);
|
||||
[[fallthrough]];
|
||||
case EBhRequire:
|
||||
case EBhEnable:
|
||||
|
|
@ -813,7 +813,8 @@ void TParseVersions::checkDeprecated(const TSourceLoc& loc, int profileMask, int
|
|||
error(loc, "deprecated, may be removed in future release", featureDesc, "");
|
||||
else if (! suppressWarnings())
|
||||
infoSink.info.message(EPrefixWarning, (TString(featureDesc) + " deprecated in version " +
|
||||
String(depVersion) + "; may be removed in future release").c_str(), loc);
|
||||
String(depVersion) + "; may be removed in future release").c_str(),
|
||||
loc, messages & EShMsgAbsolutePath, messages & EShMsgDisplayErrorColumn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -850,11 +851,14 @@ bool TParseVersions::checkExtensionsRequested(const TSourceLoc& loc, int numExte
|
|||
for (int i = 0; i < numExtensions; ++i) {
|
||||
TExtensionBehavior behavior = getExtensionBehavior(extensions[i]);
|
||||
if (behavior == EBhDisable && relaxedErrors()) {
|
||||
infoSink.info.message(EPrefixWarning, "The following extension must be enabled to use this feature:", loc);
|
||||
infoSink.info.message(EPrefixWarning, "The following extension must be enabled to use this feature:", loc,
|
||||
messages & EShMsgAbsolutePath, messages & EShMsgDisplayErrorColumn);
|
||||
behavior = EBhWarn;
|
||||
}
|
||||
if (behavior == EBhWarn) {
|
||||
infoSink.info.message(EPrefixWarning, ("extension " + TString(extensions[i]) + " is being used for " + featureDesc).c_str(), loc);
|
||||
infoSink.info.message(EPrefixWarning,
|
||||
("extension " + TString(extensions[i]) + " is being used for " + featureDesc).c_str(),
|
||||
loc, messages & EShMsgAbsolutePath, messages & EShMsgDisplayErrorColumn);
|
||||
warned = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -270,6 +270,7 @@ enum EShMessages : unsigned {
|
|||
EShMsgBuiltinSymbolTable = (1 << 14), // print the builtin symbol table
|
||||
EShMsgEnhanced = (1 << 15), // enhanced message readability
|
||||
EShMsgAbsolutePath = (1 << 16), // Output Absolute path for messages
|
||||
EShMsgDisplayErrorColumn = (1 << 17), // Display error message column aswell as line
|
||||
LAST_ELEMENT_MARKER(EShMsgCount),
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue