glgen: sync generator with manual changes
Syncs generator to accomodate manual changes to checked-in sources.
Adds note to EGL15.cpp that file is automatically generated.
Bug: 126352534
Bug: 124064285
Test: gen and diff based on generated command lines.
Change-Id: I31909de4c077679dec0323761fb06f388d128a14
diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java
index 6697189..9c80212 100644
--- a/opengl/tools/glgen/src/JniCodeEmitter.java
+++ b/opengl/tools/glgen/src/JniCodeEmitter.java
@@ -775,6 +775,19 @@
}
}
+ String getJniDefaultReturn(JType jType) {
+ if (jType.isPrimitive()) {
+ String baseType = jType.getBaseType();
+ if (baseType.equals("boolean")) {
+ return "JNI_FALSE";
+ } else {
+ return "(" + getJniType(jType) + ")0";
+ }
+ } else {
+ return "nullptr";
+ }
+ }
+
String getJniMangledName(String name) {
name = name.replaceAll("_", "_1");
name = name.replaceAll(";", "_2");
@@ -943,15 +956,15 @@
"jniThrowException(_env, \"java/lang/UnsupportedOperationException\",");
out.println(indent +
" \"" + cfunc.getName() + "\");");
- if (!isVoid) {
- String retval = getErrorReturnValue(cfunc);
+ if (isVoid) {
+ out.println(indent + "return;");
+ } else {
if (cfunc.getType().isEGLHandle()) {
String baseType = cfunc.getType().getBaseType().toLowerCase();
- out.println(indent +
- "return toEGLHandle(_env, " + baseType + "Class, " +
- baseType + "Constructor, " + retval + ");");
+ out.println(indent + indent + "return nullptr;");
} else {
- out.println(indent + "return " + retval + ";");
+ out.println(indent + indent + "return " +
+ getJniDefaultReturn(jfunc.getType()) + ";");
}
}
out.println("}");
@@ -1595,8 +1608,17 @@
out.println(indent + "if (_exception) {");
out.println(indent + indent +
"jniThrowException(_env, _exceptionType, _exceptionMessage);");
- out.println(indent + "}");
+ if (!isVoid) {
+ if (cfunc.getType().isEGLHandle()) {
+ String baseType = cfunc.getType().getBaseType().toLowerCase();
+ out.println(indent + indent + "return nullptr;");
+ } else {
+ out.println(indent + indent + "return " +
+ getJniDefaultReturn(jfunc.getType()) + ";");
+ }
+ }
+ out.println(indent + "}");
}