refactor: replace manual header guards with #pragma once

It is less error-prone than manually defining header guards. Pretty much
all compilers support it even if it's not part of the C standard.
This commit is contained in:
dundargoc
2023-11-10 12:23:42 +01:00
committed by dundargoc
parent 353a4be7e8
commit 4f8941c1a5
220 changed files with 227 additions and 998 deletions

View File

@@ -1,5 +1,4 @@
#ifndef NVIM_API_AUTOCMD_H
#define NVIM_API_AUTOCMD_H
#pragma once
#include <stdint.h>
@@ -9,4 +8,3 @@
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/autocmd.h.generated.h"
#endif
#endif // NVIM_API_AUTOCMD_H

View File

@@ -1,5 +1,4 @@
#ifndef NVIM_API_BUFFER_H
#define NVIM_API_BUFFER_H
#pragma once
#include <lauxlib.h>
@@ -10,4 +9,3 @@
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/buffer.h.generated.h"
#endif
#endif // NVIM_API_BUFFER_H

View File

@@ -1,5 +1,4 @@
#ifndef NVIM_API_COMMAND_H
#define NVIM_API_COMMAND_H
#pragma once
#include "nvim/api/keysets.h"
#include "nvim/api/private/defs.h"
@@ -9,4 +8,3 @@
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/command.h.generated.h"
#endif
#endif // NVIM_API_COMMAND_H

View File

@@ -1,5 +1,4 @@
#ifndef NVIM_API_DEPRECATED_H
#define NVIM_API_DEPRECATED_H
#pragma once
#include <stdint.h>
@@ -8,4 +7,3 @@
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/deprecated.h.generated.h"
#endif
#endif // NVIM_API_DEPRECATED_H

View File

@@ -1,5 +1,4 @@
#ifndef NVIM_API_EXTMARK_H
#define NVIM_API_EXTMARK_H
#pragma once
#include "nvim/api/keysets.h"
#include "nvim/api/private/defs.h"
@@ -14,4 +13,3 @@ EXTERN handle_T next_namespace_id INIT( = 1);
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/extmark.h.generated.h"
#endif
#endif // NVIM_API_EXTMARK_H

View File

@@ -1,5 +1,4 @@
#ifndef NVIM_API_KEYSETS_H
#define NVIM_API_KEYSETS_H
#pragma once
#include "nvim/api/private/defs.h"
@@ -314,5 +313,3 @@ typedef struct {
typedef struct {
Boolean output;
} Dict(exec_opts);
#endif // NVIM_API_KEYSETS_H

View File

@@ -1,5 +1,4 @@
#ifndef NVIM_API_OPTIONS_H
#define NVIM_API_OPTIONS_H
#pragma once
#include "nvim/api/keysets.h"
#include "nvim/api/private/defs.h"
@@ -8,5 +7,3 @@
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/options.h.generated.h"
#endif
#endif // NVIM_API_OPTIONS_H

View File

@@ -1,5 +1,4 @@
#ifndef NVIM_API_PRIVATE_CONVERTER_H
#define NVIM_API_PRIVATE_CONVERTER_H
#pragma once
#include "nvim/api/private/defs.h"
#include "nvim/eval/typval_defs.h"
@@ -7,5 +6,3 @@
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/private/converter.h.generated.h"
#endif
#endif // NVIM_API_PRIVATE_CONVERTER_H

View File

@@ -1,5 +1,4 @@
#ifndef NVIM_API_PRIVATE_DEFS_H
#define NVIM_API_PRIVATE_DEFS_H
#pragma once
#include <stdbool.h>
#include <stdint.h>
@@ -139,5 +138,3 @@ typedef struct {
} KeySetLink;
typedef KeySetLink *(*FieldHashfn)(const char *str, size_t len);
#endif // NVIM_API_PRIVATE_DEFS_H

View File

@@ -1,5 +1,4 @@
#ifndef NVIM_API_PRIVATE_DISPATCH_H
#define NVIM_API_PRIVATE_DISPATCH_H
#pragma once
#include <stdbool.h>
#include <stdint.h>
@@ -30,5 +29,3 @@ extern const MsgpackRpcRequestHandler method_handlers[];
# include "api/private/dispatch_wrappers.h.generated.h"
# include "keysets_defs.generated.h"
#endif
#endif // NVIM_API_PRIVATE_DISPATCH_H

View File

@@ -1,5 +1,4 @@
#ifndef NVIM_API_PRIVATE_HELPERS_H
#define NVIM_API_PRIVATE_HELPERS_H
#pragma once
#include <stdbool.h>
#include <stddef.h>
@@ -199,5 +198,3 @@ typedef struct {
current_channel_id = save_channel_id; \
current_sctx = save_current_sctx; \
} while (0);
#endif // NVIM_API_PRIVATE_HELPERS_H

View File

@@ -1,5 +1,4 @@
#ifndef NVIM_API_PRIVATE_VALIDATE_H
#define NVIM_API_PRIVATE_VALIDATE_H
#pragma once
#include <stdbool.h>
#include <stddef.h>
@@ -95,5 +94,3 @@
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/private/validate.h.generated.h"
#endif
#endif // NVIM_API_PRIVATE_VALIDATE_H

View File

@@ -1,9 +1,7 @@
#ifndef NVIM_API_TABPAGE_H
#define NVIM_API_TABPAGE_H
#pragma once
#include "nvim/api/private/defs.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/tabpage.h.generated.h"
#endif
#endif // NVIM_API_TABPAGE_H

View File

@@ -1,5 +1,4 @@
#ifndef NVIM_API_UI_H
#define NVIM_API_UI_H
#pragma once
#include <stdint.h>
@@ -11,4 +10,3 @@
# include "api/ui.h.generated.h"
# include "ui_events_remote.h.generated.h"
#endif
#endif // NVIM_API_UI_H

View File

@@ -1,5 +1,4 @@
#ifndef NVIM_API_UI_EVENTS_IN_H
#define NVIM_API_UI_EVENTS_IN_H
#pragma once
// This file is not compiled, just parsed for definitions
#ifdef INCLUDE_GENERATED_DECLARATIONS
@@ -170,4 +169,3 @@ void msg_history_clear(void)
void error_exit(Integer status)
FUNC_API_SINCE(12);
#endif // NVIM_API_UI_EVENTS_IN_H

View File

@@ -1,5 +1,4 @@
#ifndef NVIM_API_VIM_H
#define NVIM_API_VIM_H
#pragma once
#include "nvim/api/keysets.h"
#include "nvim/api/private/defs.h"
@@ -7,4 +6,3 @@
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/vim.h.generated.h"
#endif
#endif // NVIM_API_VIM_H

View File

@@ -1,5 +1,4 @@
#ifndef NVIM_API_VIMSCRIPT_H
#define NVIM_API_VIMSCRIPT_H
#pragma once
#include "nvim/api/keysets.h"
#include "nvim/api/private/defs.h"
@@ -7,4 +6,3 @@
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/vimscript.h.generated.h"
#endif
#endif // NVIM_API_VIMSCRIPT_H

View File

@@ -1,5 +1,4 @@
#ifndef NVIM_API_WIN_CONFIG_H
#define NVIM_API_WIN_CONFIG_H
#pragma once
#include "nvim/api/keysets.h"
#include "nvim/api/private/defs.h"
@@ -8,4 +7,3 @@
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/win_config.h.generated.h"
#endif
#endif // NVIM_API_WIN_CONFIG_H

View File

@@ -1,5 +1,4 @@
#ifndef NVIM_API_WINDOW_H
#define NVIM_API_WINDOW_H
#pragma once
#include "nvim/api/keysets.h"
#include "nvim/api/private/defs.h"
@@ -7,4 +6,3 @@
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/window.h.generated.h"
#endif
#endif // NVIM_API_WINDOW_H