Some classes are forward declared as structs and vice versa
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mir |
Fix Released
|
Medium
|
Daniel van Vugt |
Bug Description
The class definitions of Mir are unclean. There are tons of classes that are in fact structs but which are forward declared as classes.
As an example, Rectangle is actually a struct but the code base is littered with forward declarations of type "class Rectangle".
Gcc as of current will not warn about these. Clang will, which makes the code base uncompilable with Clang, meaning we can't use all the cool stuff that Clang provides (static code analysis etc). It is also probable that Gcc will start complaining about this eventually.
Since there are so many of these, the only sane way to solve it is to provide a mir_forward_
struct MirFoo;
struct MirBar;
class MirSomething;
and have everyone include that instead of trying to guess the type of forward declarations all over the code base.
This follows the standard approach of "only ever declare anything once".
Related branches
- PS Jenkins bot (community): Approve (continuous-integration)
- Kevin DuBois (community): Approve
- Robert Carr (community): Approve
- Alan Griffiths: Approve
- Alexandros Frantzis: Pending requested
-
Diff: 645 lines (+73/-91)40 files modifiedCMakeLists.txt (+15/-2)
cmake/src/mir/mir_discover_gtest_tests.cpp (+0/-21)
examples/image_renderer.cpp (+4/-0)
include/server/mir/compositor/buffer.h (+1/-1)
include/server/mir/compositor/buffer_allocation_strategy.h (+1/-1)
include/server/mir/compositor/buffer_bundle_manager.h (+1/-1)
include/server/mir/compositor/buffer_bundle_surfaces.h (+1/-1)
include/server/mir/compositor/graphic_buffer_allocator.h (+1/-1)
include/server/mir/compositor/swapper_factory.h (+1/-1)
include/server/mir/frontend/shell.h (+1/-1)
include/server/mir/graphics/platform.h (+1/-1)
include/server/mir/graphics/renderable.h (+5/-0)
include/server/mir/shell/session_manager.h (+1/-1)
include/server/mir/shell/surface_builder.h (+1/-1)
include/server/mir/surfaces/buffer_bundle_factory.h (+1/-1)
include/server/mir/surfaces/surface_stack.h (+1/-1)
include/server/mir/surfaces/surface_stack_model.h (+1/-1)
include/shared/mir/geometry/forward.h (+3/-3)
src/client/client_buffer.h (+1/-1)
src/client/client_buffer_depository.h (+1/-1)
src/client/client_context.h (+2/-2)
src/client/mir_connection.h (+1/-1)
src/client/mir_surface.h (+2/-2)
src/client/mir_wait_handle.h (+1/-1)
src/server/frontend/protobuf_socket_communicator.h (+2/-1)
src/server/graphics/gbm/gbm_buffer_allocator.h (+1/-1)
src/server/graphics/gbm/gbm_display.h (+1/-1)
src/server/graphics/gbm/gbm_display_buffer.cpp (+0/-8)
src/server/graphics/gbm/gbm_display_helpers.h (+1/-1)
src/server/graphics/gbm/kms_display_configuration.cpp (+0/-1)
src/server/graphics/gbm/kms_display_configuration.h (+0/-1)
tests/CMakeLists.txt (+6/-0)
tests/death-tests/test_application_manager_death.cpp (+5/-4)
tests/integration-tests/test_drm_auth_magic.cpp (+1/-1)
tests/integration-tests/test_surfaceloop.cpp (+1/-2)
tests/mir_test_framework/testing_process_manager.cpp (+3/-19)
tests/unit-tests/geometry/test-displacement.cpp (+1/-1)
tests/unit-tests/geometry/test-point.cpp (+1/-1)
tests/unit-tests/geometry/test-rectangle.cpp (+1/-1)
tests/unit-tests/graphics/gbm/mock_gbm.h (+1/-1)
Changed in mir: | |
status: | New → Triaged |
importance: | Undecided → Medium |
Changed in mir: | |
assignee: | nobody → Daniel van Vugt (vanvugt) |
Changed in mir: | |
status: | Triaged → In Progress |
Changed in mir: | |
milestone: | none → 0.0.3 |
Changed in mir: | |
status: | Fix Committed → Fix Released |
I just wonder why clang warns about this. The code is conforming and not dangerous.