From da909f84dc8421052c92491baa7dd90e1c78dc8f Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 8 Mar 2015 00:06:11 +0100 Subject: Bug 1134 - Use ASTLocationTag in Logging (PCPP, Emitter); Refine ASTLocationTag log/exception formatting. Since commit eca019cdea4017227e951d8a9eb30cb34fca4a07, we have ASTLocationTag available. Hence use it for all logging purposes and emit a standard compiler output, which shall be parsable by other tools. --- .../gluegen/procaddress/ProcAddressConfiguration.java | 13 +++++++------ .../com/jogamp/gluegen/procaddress/ProcAddressEmitter.java | 10 +++++----- 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'src/java/com/jogamp/gluegen/procaddress') diff --git a/src/java/com/jogamp/gluegen/procaddress/ProcAddressConfiguration.java b/src/java/com/jogamp/gluegen/procaddress/ProcAddressConfiguration.java index 50334c6..c10e03b 100644 --- a/src/java/com/jogamp/gluegen/procaddress/ProcAddressConfiguration.java +++ b/src/java/com/jogamp/gluegen/procaddress/ProcAddressConfiguration.java @@ -42,6 +42,7 @@ import static java.util.logging.Level.INFO; import com.jogamp.gluegen.JavaConfiguration; import com.jogamp.gluegen.cgram.types.AliasedSymbol; +import com.jogamp.gluegen.cgram.types.FunctionSymbol; import java.io.*; import java.text.*; @@ -273,12 +274,12 @@ public class ProcAddressConfiguration extends JavaConfiguration { return tableClassName; } - public boolean skipProcAddressGen(final AliasedSymbol symbol) { + public boolean skipProcAddressGen(final FunctionSymbol symbol) { if ( skipProcAddressGen.contains( symbol.getName() ) || oneInSet(skipProcAddressGen, symbol.getAliasedNames()) ) { - LOG.log(INFO, "Skip ProcAddress: {0}", symbol.getAliasedString()); + LOG.log(INFO, symbol.getASTLocusTag(), "Skip ProcAddress: {0}", symbol.getAliasedString()); return true; } return false; @@ -309,11 +310,11 @@ public class ProcAddressConfiguration extends JavaConfiguration { return procAddressNameConverter.convert(funcName); } - public boolean forceProcAddressGen(final AliasedSymbol symbol) { + public boolean forceProcAddressGen(final FunctionSymbol symbol) { if( forceProcAddressGen4All ) { if(!forceProcAddressGen4AllOnce) { forceProcAddressGen4AllOnce = true; - LOG.log(INFO, "Force ALL ProcAddress"); + LOG.log(INFO, symbol.getASTLocusTag(), "Force ALL ProcAddress"); } return true; } @@ -322,7 +323,7 @@ public class ProcAddressConfiguration extends JavaConfiguration { oneInSet(forceProcAddressGenSet, symbol.getAliasedNames()) ) { - LOG.log(INFO, "Force ProcAddress: {0}", symbol.getAliasedString()); + LOG.log(INFO, symbol.getASTLocusTag(), "Force ProcAddress: {0}", symbol.getAliasedString()); return true; } return false; @@ -338,7 +339,7 @@ public class ProcAddressConfiguration extends JavaConfiguration { localProcAddressCallingConventionMap.put(funcName, callingConvention); } - public String getLocalProcAddressCallingConvention(final AliasedSymbol symbol) { + public String getLocalProcAddressCallingConvention(final FunctionSymbol symbol) { if ( isLocalProcAddressCallingConvention4All() ) { return getLocalProcAddressCallingConvention4All(); } diff --git a/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java b/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java index 23c7fb5..180c48f 100644 --- a/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java +++ b/src/java/com/jogamp/gluegen/procaddress/ProcAddressEmitter.java @@ -134,7 +134,7 @@ public class ProcAddressEmitter extends JavaEmitter { // honor that (for example, the superclass might have caught an Ignore // direction that matched the symbol's name). if (defaultEmitters.isEmpty()) { - LOG.log(Level.INFO, "genModProcAddrEmitter: SKIP, empty binding set: {0}", sym.getAliasedString()); + LOG.log(Level.INFO, sym.getASTLocusTag(), "genModProcAddrEmitter: SKIP, empty binding set: {0}", sym.getAliasedString()); return defaultEmitters; } @@ -143,7 +143,7 @@ public class ProcAddressEmitter extends JavaEmitter { // Don't do anything special if this symbol doesn't require modifications if( !callThroughProcAddress || isUnimplemented ) { - LOG.log(Level.INFO, "genModProcAddrEmitter: SKIP, not needed: callThrough {0}, isUnimplemented {1}: {2}", + LOG.log(Level.INFO, sym.getASTLocusTag(), "genModProcAddrEmitter: SKIP, not needed: callThrough {0}, isUnimplemented {1}: {2}", callThroughProcAddress, isUnimplemented, sym.getAliasedString()); return defaultEmitters; } @@ -252,7 +252,7 @@ public class ProcAddressEmitter extends JavaEmitter { final boolean needsLocalTypedef = getProcAddressConfig().forceProcAddressGen(cSymbol) || !hasFunctionPointerTypedef(cSymbol); final boolean callThroughProcAddress = needsLocalTypedef || callThroughProcAddress(cSymbol); - LOG.log(Level.INFO, "genModProcAddrEmitter: needsTypedef {0}, callThrough {1}: {2}", + LOG.log(Level.INFO, cSymbol.getASTLocusTag(), "genModProcAddrEmitter: needsTypedef {0}, callThrough {1}: {2}", needsLocalTypedef, callThroughProcAddress, cSymbol.getAliasedString()); String forcedCallingConvention = null; @@ -300,13 +300,13 @@ public class ProcAddressEmitter extends JavaEmitter { mode = 3; } } - LOG.log(Level.INFO, "callThroughProcAddress: {0} [m {1}]: {2}", res, mode, sym.getAliasedString()); + LOG.log(Level.INFO, sym.getASTLocusTag(), "callThroughProcAddress: {0} [m {1}]: {2}", res, mode, sym.getAliasedString()); return res; } protected boolean hasFunctionPointerTypedef(final FunctionSymbol sym) { final String funcPointerTypedefName = getFunctionPointerTypedefName(sym); final boolean res = typedefDictionary.containsKey(funcPointerTypedefName); - LOG.log(Level.INFO, "hasFunctionPointerTypedef: {0}: {1}", res, sym.getAliasedString()); + LOG.log(Level.INFO, sym.getASTLocusTag(), "hasFunctionPointerTypedef: {0}: {1}", res, sym.getAliasedString()); return res; } -- cgit v1.2.3