Godot: Missing header guards in a lot of files

Created on 18 Mar 2020  路  4Comments  路  Source: godotengine/godot

Godot version:
master build https://github.com/godotengine/godot/commit/ae28c0fdb8f22dc26339e9f81b555e129f61b010

OS/device including version:
Any

Issue description:
As detected by LGTM, there are currently 55 files without header guards. Many of them seem to be register_types.h. A helpful list by Akein can be found here.
I think we should add missing #include guards in all files that are missing it.
Because missing both #pragma once and #include guard seems to be more concerning matter compared to choosing between them.
Also, if and when we do decide to change it, we can just guardonce tools to convert between them.
Related: #18143 (where I have mentioned this before).
Note: #36324 is also part of this. I created this issue as there wasn't an issue for all concerned files.

Steps to reproduce:
Visit https://lgtm.com/projects/g/godotengine/godot/alerts?mode=list&id=cpp%2Fmissing-header-guard.

enhancement core

Most helpful comment

@RajatGoswami That seems like a good solution yes.

All 4 comments

Hey @Anutrix, I can take care of this. For the multiple instances of register_types.h files missing include guards, do you suggest prefixing the macro names with the name of the parent directory to maintain uniqueness? For example:

#ifndef WEBSOCKET_REGISTER_TYPES_H
#define WEBSOCKET_REGISTER_TYPES_H

for root/modules/websocket/register_types.h and

#ifndef ANDROID_EXPORT_H
#define ANDROID_EXPORT_H

for root/platform/android/export/export.h

@RajatGoswami That seems like a good solution yes.

Thanks! I've created a PR here for the requested changes: https://github.com/godotengine/godot/pull/37219

Fixed by #37219.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RebelliousX picture RebelliousX  路  3Comments

SleepProgger picture SleepProgger  路  3Comments

blurymind picture blurymind  路  3Comments

Zylann picture Zylann  路  3Comments

EdwardAngeles picture EdwardAngeles  路  3Comments