[foreign-jextract] RFR: 8259226: jextract should differentiate between clang errors vs other runtime issues

Maurizio Cimadamore mcimadamore at openjdk.java.net
Tue Jan 5 11:48:03 UTC 2021


On Tue, 5 Jan 2021 10:43:29 GMT, Athijegannathan Sundararajan <sundar at openjdk.org> wrote:

> CLANG_ERROR error code added. Also OUTPUT_ERROR exit code is used as expected.

While the changes look good, I think that the category CLANG_ERROR seems too broad. I think it would be useful to distinguish between genuine errors (e.g. syntax error in header) and an error that occurs because of some issues in the internal parsing machinery. The latter to me seems more a case of RUNTIME_ERROR than CLANG_ERROR. I have pointed out some examples in the code.

src/jdk.incubator.jextract/share/classes/jdk/internal/clang/AccessSpecifier.java line 64:

> 62:         AccessSpecifier x = lookup.get(value);
> 63:         if (null == x) {
> 64:             throw new ClangException("Invalid AccessSpecifier kind value: " + value);

Should this be a CLANG_ERROR?

src/jdk.incubator.jextract/share/classes/jdk/internal/clang/CallingConvention.java line 71:

> 69:         CallingConvention x = lookup.get(value);
> 70:         if (null == x) {
> 71:             throw new ClangException("Invalid calling convention: " + value);

Should this be a CLANG_ERROR?

src/jdk.incubator.jextract/share/classes/jdk/internal/clang/CursorKind.java line 296:

> 294:         CursorKind x = lookup.get(value);
> 295:         if (null == x) {
> 296:             throw new ClangException("Invalid Cursor kind value: " + value);

Should this be a CLANG_ERROR?

src/jdk.incubator.jextract/share/classes/jdk/internal/clang/EvalResult.java line 74:

> 72:                 return getAsInt0();
> 73:             default:
> 74:                 throw new ClangException("Unexpected kind: " + kind);

Should this be a CLANG_ERROR? Same for others in this file

-------------

PR: https://git.openjdk.java.net/panama-foreign/pull/429


More information about the panama-dev mailing list