Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing constructor priority warning #177

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Zacharyprime
Copy link
Member

If the original was intentional, feel free to delete this PR.

This section throws the following warning:

/home/zachary/libwallaby/module/servo/src/init.cpp:7:31: warning: constructor priorities from 0 to 100 are reserved for the implementation [-Wprio-ctor-dtor]
    7 |   void register_servo_cleanup()
      |                               ^

This comes from this definition:

#include "kipr/servo/servo.h"
#include "kipr/core/cleanup.hpp"

namespace
{
  __attribute__((constructor(2)))
  void register_servo_cleanup()
  {
    kipr::core::cleanup_add(disable_servos);
  }
}

According to C++ documentation, 0-100 is reserved for internal use.
However, in the commit that made this change Braden says it is to get around WASM bugs, so it may have been intentional.
I tried to find the WASM/emscripten error that would have prompted the change, but I couldn't find anything.
I did find documentation saying that emscripten uses a priority of 50, so it's possible 2 was chosen to beat that value.

I would test this to see what bugs appear, but I don't know what build configuration is being used for WASM.

@Zacharyprime Zacharyprime linked an issue Nov 4, 2022 that may be closed by this pull request
Base automatically changed from refactor to master January 19, 2024 07:25
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.

Fix all compilation warnings
1 participant