Skip to content

Use #pragma once#192

Merged
smcv merged 2 commits intomainfrom
pragma-once
Feb 10, 2025
Merged

Use #pragma once#192
smcv merged 2 commits intomainfrom
pragma-once

Conversation

@smcv
Copy link
Copy Markdown
Contributor

@smcv smcv commented Feb 10, 2025

  • Use #pragma once in all headers that do not already have guards

    It's easier to deal with header files when it's unconditionally safe to
    include the same header more than once.

    In particular the absence of #pragma once in glib-backports.h caused
    a build failure in inputcapture: Reference-count Call objects #191, but only for older GLib releases.

  • Qt: Use #pragma once instead of traditional single-inclusion guards

    This is slightly more efficient, and removes any concerns about whether
    we have reused the same macro name for two different headers.

smcv added 2 commits February 10, 2025 13:11
It's easier to deal with header files when it's unconditionally safe to
include the same header more than once.

In particular the absence of `#pragma once` in `glib-backports.h` caused
a build failure in #191, but only for older GLib releases.

Signed-off-by: Simon McVittie <smcv@debian.org>
This is slightly more efficient, and removes any concerns about whether
we have reused the same macro name for two different headers.

Signed-off-by: Simon McVittie <smcv@debian.org>
@smcv smcv merged commit c0eb0f9 into main Feb 10, 2025
@smcv smcv deleted the pragma-once branch February 10, 2025 16:58
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