Skip to content

Conversation

@jschwe
Copy link
Member

@jschwe jschwe commented Nov 18, 2025

Extracted from #583.

target_is_ohos was not working as expected. This presumably originated in a seemingly harmless suggestion,
but surprisingly the expected return type / values for these functions is True | None, and not True | False (The other functions like target_is_xx don't return anything explicitly if the if does not match, which results in a None implicitly I guess). Returning False does not give the expected result. I noticed this while working on #583 - normally logs are still visible in servo, since we setup a thread that redirects output from stdout / stderr to the logging system on ohos (except in production mode).

Fixing the ohos define also revealed some issues with the patches:

  • In the current version of SM, LogLevel defined in hilog/log.h collides with a LogLevel in the js namespace. Some of the header files we included hilog in, have this collision, and are also used from C files, so we can't just namespace the import (without the patch getting quite ugly).To avoid these issues we just copy the function declaration, and use raw integers instead of the enum in the function signature.

@jschwe jschwe force-pushed the jschwender/fix-ohos-define branch from 880c396 to f5b45b6 Compare November 18, 2025 20:14
@jschwe jschwe force-pushed the jschwender/fix-ohos-define branch from 83f7fa6 to 32c419a Compare November 21, 2025 05:40
Signed-off-by: Jonathan Schwender <[email protected]>
Signed-off-by: Jonathan Schwender <[email protected]>
Assertions .h is also included in `c` files, so using namespaces
is not an option to avoid the collision.
js::LogLevel, collides with the hilog LogLevel enum.

Signed-off-by: Jonathan Schwender <[email protected]>
Signed-off-by: Jonathan Schwender <[email protected]>
Signed-off-by: Jonathan Schwender <[email protected]>
@jschwe jschwe force-pushed the jschwender/fix-ohos-define branch from 32c419a to 79183e7 Compare November 24, 2025 07:41
Signed-off-by: Jonathan Schwender <[email protected]>
@jschwe jschwe added this pull request to the merge queue Nov 24, 2025
@jschwe jschwe removed this pull request from the merge queue due to a manual request Nov 24, 2025
@jschwe
Copy link
Member Author

jschwe commented Nov 24, 2025

Todo: add ci configuration for ohos with debugmozjs
Edit: done

@jschwe
Copy link
Member Author

jschwe commented Nov 24, 2025

This PR did change a bit since the initial review, so it might make sense to be reviewed again. I'm not super happy with inlining the function declaration in every file it is used, but I don't think it would make the patching easier, if I wrapped the logging in a new header file.

@jschwe jschwe requested a review from jdm November 24, 2025 20:56
Copy link
Member

@jdm jdm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair.

@jdm jdm added this pull request to the merge queue Nov 25, 2025
Merged via the queue into servo:main with commit dfae36e Nov 25, 2025
38 checks passed
@jschwe jschwe deleted the jschwender/fix-ohos-define branch November 25, 2025 07:56
jschwe added a commit that referenced this pull request Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants