Skip to content

Commit

Permalink
core: Compiler fixes and options (hyprwm#141)
Browse files Browse the repository at this point in the history
* reorder ctors

* sign-compare

* Add some compile options from Hyprland
  • Loading branch information
Honkazel authored Feb 2, 2025
1 parent 257b205 commit 343178b
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ pkg_check_modules(
configure_file(aquamarine.pc.in aquamarine.pc @ONLY)

set(CMAKE_CXX_STANDARD 23)
add_compile_options(
-Wall
-Wextra
-Wno-unused-parameter
-Wno-unused-value
-Wno-missing-field-initializers)
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)

if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
Expand Down
2 changes: 1 addition & 1 deletion src/allocator/DRMDumb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,6 @@ eAllocatorType Aquamarine::CDRMDumbAllocator::type() {
return eAllocatorType::AQ_ALLOCATOR_TYPE_DRM_DUMB;
}

Aquamarine::CDRMDumbAllocator::CDRMDumbAllocator(int fd_, Hyprutils::Memory::CWeakPointer<CBackend> backend_) : drmfd(fd_), backend(backend_) {
Aquamarine::CDRMDumbAllocator::CDRMDumbAllocator(int fd_, Hyprutils::Memory::CWeakPointer<CBackend> backend_) : backend(backend_), drmfd(fd_) {
; // nothing to do
}
4 changes: 2 additions & 2 deletions src/backend/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static const libinput_interface libinputListener = {

// ------------

Aquamarine::CSessionDevice::CSessionDevice(Hyprutils::Memory::CSharedPointer<CSession> session_, const std::string& path_) : session(session_), path(path_) {
Aquamarine::CSessionDevice::CSessionDevice(Hyprutils::Memory::CSharedPointer<CSession> session_, const std::string& path_) : path(path_), session(session_) {
deviceID = libseat_open_device(session->libseatHandle, path.c_str(), &fd);
if (deviceID < 0) {
session->backend->log(AQ_LOG_ERROR, std::format("libseat: Couldn't open device at {}", path_));
Expand Down Expand Up @@ -1025,7 +1025,7 @@ Aquamarine::CLibinputTabletPad::CLibinputTabletPad(Hyprutils::Memory::CSharedPoi
paths.emplace_back(udev_device_get_syspath(udevice));

int groupsno = libinput_device_tablet_pad_get_num_mode_groups(device->device);
for (size_t i = 0; i < groupsno; ++i) {
for (int i = 0; i < groupsno; ++i) {
auto g = createGroupFromID(i);
if (g)
groups.emplace_back(g);
Expand Down
2 changes: 1 addition & 1 deletion src/backend/Wayland.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ Aquamarine::CWaylandBuffer::CWaylandBuffer(SP<IBuffer> buffer_, Hyprutils::Memor

auto attrs = buffer->dmabuf();

for (size_t i = 0; i < attrs.planes; ++i) {
for (int i = 0; i < attrs.planes; ++i) {
params->sendAdd(attrs.fds.at(i), i, attrs.offsets.at(i), attrs.strides.at(i), attrs.modifier >> 32, attrs.modifier & 0xFFFFFFFF);
}

Expand Down
8 changes: 4 additions & 4 deletions src/backend/drm/DRM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ bool Aquamarine::CDRMBackend::initResources() {

backend->log(AQ_LOG_DEBUG, std::format("drm: found {} CRTCs", resources->count_crtcs));

for (size_t i = 0; i < resources->count_crtcs; ++i) {
for (int i = 0; i < resources->count_crtcs; ++i) {
auto CRTC = makeShared<SDRMCRTC>();
CRTC->id = resources->crtcs[i];
CRTC->backend = self;
Expand Down Expand Up @@ -762,7 +762,7 @@ void Aquamarine::CDRMBackend::scanConnectors() {
return;
}

for (size_t i = 0; i < resources->count_connectors; ++i) {
for (int i = 0; i < resources->count_connectors; ++i) {
uint32_t connectorID = resources->connectors[i];

SP<SDRMConnector> conn;
Expand Down Expand Up @@ -804,7 +804,7 @@ void Aquamarine::CDRMBackend::scanConnectors() {

// cleanup hot unplugged connectors
std::erase_if(connectors, [resources](const auto& conn) {
for (size_t i = 0; i < resources->count_connectors; ++i) {
for (int i = 0; i < resources->count_connectors; ++i) {
if (resources->connectors[i] == conn->id)
return false;
}
Expand Down Expand Up @@ -2103,7 +2103,7 @@ uint32_t Aquamarine::CDRMFB::submitBuffer() {

auto attrs = buffer->dmabuf();
std::array<uint64_t, 4> mods = {0, 0, 0, 0};
for (size_t i = 0; i < attrs.planes; ++i) {
for (int i = 0; i < attrs.planes; ++i) {
mods[i] = attrs.modifier;
}

Expand Down
2 changes: 1 addition & 1 deletion src/backend/drm/Props.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ namespace Aquamarine {
if (!prop)
return false;

for (uint32_t i = 0; i < prop->count_enums; ++i) {
for (int i = 0; i < prop->count_enums; ++i) {
const prop_info* p = (prop_info*)bsearch(prop->enums[i].name, info, info_len, sizeof(info[0]), comparePropInfo);
if (p)
result[p->index] = prop->enums[i].value;
Expand Down
2 changes: 1 addition & 1 deletion src/backend/drm/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,6 @@ bool CDRMRenderer::verifyDestinationDMABUF(const SDMABUFAttrs& attrs) {

CDRMRendererBufferAttachment::CDRMRendererBufferAttachment(Hyprutils::Memory::CWeakPointer<CDRMRenderer> renderer_, Hyprutils::Memory::CSharedPointer<IBuffer> buffer,
EGLImageKHR image, GLuint fbo_, GLuint rbo_, SGLTex tex_) :
eglImage(image), fbo(fbo_), rbo(rbo_), renderer(renderer_), tex(tex_) {
eglImage(image), fbo(fbo_), rbo(rbo_), tex(tex_), renderer(renderer_) {
bufferDestroy = buffer->events.destroy.registerListener([this](std::any d) { renderer->onBufferAttachmentDrop(this); });
}

0 comments on commit 343178b

Please sign in to comment.