Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use #pragma once instead of include guards #6397

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/adts/bit_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#ifndef TIMESCALEDB_ADT_BITARRAY_H
#define TIMESCALEDB_ADT_BITARRAY_H
#pragma once

#include <postgres.h>

Expand Down Expand Up @@ -54,5 +53,3 @@ static uint64 bit_array_num_bits(const BitArray *array);
static uint32 bit_array_num_buckets(const BitArray *array);
static uint64 *bit_array_buckets(const BitArray *array);
static size_t bit_array_data_bytes_used(const BitArray *array);

#endif
5 changes: 1 addition & 4 deletions src/adts/bit_array_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#ifndef TIMESCALEDB_ADT_BITARRAY_IMPL_H
#define TIMESCALEDB_ADT_BITARRAY_IMPL_H
#pragma once

#include <postgres.h>

Expand Down Expand Up @@ -353,5 +352,3 @@ bit_array_low_bits_mask(uint8 bits_used)
else
return (UINT64CONST(1) << bits_used) - UINT64CONST(1);
}

#endif
5 changes: 1 addition & 4 deletions src/adts/char_vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#ifndef TIMESCALEDB_ADT_CHAR_VEC_H
#define TIMESCALEDB_ADT_CHAR_VEC_H
#pragma once

#define VEC_PREFIX char
#define VEC_ELEMENT_TYPE char
#define VEC_DECLARE 1
#define VEC_DEFINE 1
#define VEC_SCOPE static inline
#include <adts/vec.h>

#endif
5 changes: 1 addition & 4 deletions src/adts/uint64_vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#ifndef TIMESCALEDB_ADT_UINT64_VEC_H
#define TIMESCALEDB_ADT_UINT64_VEC_H
#pragma once

#define VEC_PREFIX uint64
#define VEC_ELEMENT_TYPE uint64
#define VEC_DECLARE 1
#define VEC_DEFINE 1
#define VEC_SCOPE static inline
#include <adts/vec.h>

#endif
5 changes: 1 addition & 4 deletions src/annotations.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#ifndef TIMESCALEDB_ANNOTATIONS_H
#define TIMESCALEDB_ANNOTATIONS_H
#pragma once

/* Supported since clang 12 and GCC 7 */
#if defined __has_attribute
Expand All @@ -26,5 +25,3 @@
#else
#define TS_USED
#endif

#endif /* TIMESCALEDB_ANNOTATIONS_H */
5 changes: 1 addition & 4 deletions src/bgw/job.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#ifndef BGW_JOB_H
#define BGW_JOB_H
#pragma once

#include <postgres.h>
#include <storage/lock.h>
Expand Down Expand Up @@ -69,5 +68,3 @@ extern TSDLLEXPORT void ts_bgw_job_validate_schedule_interval(Interval *schedule
extern TSDLLEXPORT char *ts_bgw_job_validate_timezone(Datum timezone);

extern TSDLLEXPORT bool ts_is_telemetry_job(BgwJob *job);

#endif /* BGW_JOB_H */
4 changes: 1 addition & 3 deletions src/bgw/job_stat.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#ifndef BGW_JOB_STAT_H
#define BGW_JOB_STAT_H
#pragma once

#include "ts_catalog/catalog.h"
#include "job.h"
Expand Down Expand Up @@ -45,4 +44,3 @@ extern TSDLLEXPORT void ts_bgw_job_stat_mark_crash_reported(int32 bgw_job_id);

extern TSDLLEXPORT TimestampTz ts_get_next_scheduled_execution_slot(BgwJob *job,
TimestampTz finish_time);
#endif /* BGW_JOB_STAT_H */
4 changes: 1 addition & 3 deletions src/bgw/launcher_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#ifndef TIMESCALEDB_BGW_LAUNCHER_INTERFACE_H
#define TIMESCALEDB_BGW_LAUNCHER_INTERFACE_H
#pragma once

#include <postgres.h>

Expand All @@ -13,4 +12,3 @@ extern void ts_bgw_worker_release(void);
extern int ts_bgw_num_unreserved(void);
extern int ts_bgw_loader_api_version(void);
extern void ts_bgw_check_loader_api_version(void);
#endif /* TIMESCALEDB_BGW_LAUNCHER_INTERFACE_H */
6 changes: 2 additions & 4 deletions src/bgw/scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#ifndef BGW_SCHEDULER_H
#define BGW_SCHEDULER_H
#pragma once

#include <postgres.h>
#include <fmgr.h>
#include "compat/compat.h"
Expand Down Expand Up @@ -36,5 +36,3 @@ extern void ts_bgw_scheduler_register_signal_handlers(void);
extern void ts_bgw_scheduler_setup_mctx(void);

extern BackgroundWorkerHandle *ts_bgw_start_worker(const char *name, const BgwParams *bgw_params);

#endif /* BGW_SCHEDULER_H */
5 changes: 1 addition & 4 deletions src/bgw/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#ifndef BGW_TIMER_H
#define BGW_TIMER_H
#pragma once

#include <postgres.h>
#include <utils/timestamp.h>
Expand All @@ -26,5 +25,3 @@ extern TSDLLEXPORT TimestampTz ts_timer_get_current_timestamp(void);
extern void ts_timer_set(const Timer *timer);
extern const Timer *ts_get_standard_timer(void);
#endif

#endif /* BGW_TIMER_H */
6 changes: 1 addition & 5 deletions src/bgw/worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/

#ifndef BGW_WORKER_H
#define BGW_WORKER_H
#pragma once

#include <postgres.h>

Expand Down Expand Up @@ -49,5 +47,3 @@ typedef struct BgwParams
*/
StaticAssertDecl(sizeof(BgwParams) <= sizeof(((BackgroundWorker *) 0)->bgw_extra),
"sizeof(BgwParams) exceeds sizeof(bgw_extra) field of BackgroundWorker");

#endif /* BGW_WORKER_H */
6 changes: 1 addition & 5 deletions src/bgw_policy/chunk_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/

#ifndef TIMESCALEDB_BGW_JOB_CHUNK_STATS_H
#define TIMESCALEDB_BGW_JOB_CHUNK_STATS_H
#pragma once

#include "ts_catalog/catalog.h"
#include "export.h"
Expand All @@ -21,5 +19,3 @@ extern void ts_bgw_policy_chunk_stats_delete_row_only_by_job_id(int32 job_id);
extern void ts_bgw_policy_chunk_stats_delete_by_chunk_id(int32 chunk_id);
extern TSDLLEXPORT void ts_bgw_policy_chunk_stats_record_job_run(int32 job_id, int32 chunk_id,
TimestampTz last_time_job_run);

#endif /* TIMESCALEDB_BGW_JOB_CHUNK_STATS_H */
6 changes: 1 addition & 5 deletions src/bgw_policy/policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/

#ifndef TIMESCALEDB_BGW_POLICY_POLICY_H
#define TIMESCALEDB_BGW_POLICY_POLICY_H
#pragma once

#include "scanner.h"
#include "ts_catalog/catalog.h"
Expand All @@ -15,5 +13,3 @@
extern ScanTupleResult ts_bgw_policy_delete_row_only_tuple_found(TupleInfo *ti, void *const data);

extern void ts_bgw_policy_delete_by_hypertable_id(int32 hypertable_id);

#endif /* TIMESCALEDB_BGW_POLICY_POLICY_H */
5 changes: 1 addition & 4 deletions src/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#ifndef TIMESCALEDB_CACHE_H
#define TIMESCALEDB_CACHE_H
#pragma once

#include <postgres.h>
#include <utils/memutils.h>
Expand Down Expand Up @@ -71,5 +70,3 @@ extern TSDLLEXPORT int ts_cache_release(Cache *cache);

extern void _cache_init(void);
extern void _cache_fini(void);

#endif /* TIMESCALEDB_CACHE_H */
5 changes: 1 addition & 4 deletions src/cache_invalidate.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#ifndef TIMESCALEDB_CACHE_INVALIDATE_H
#define TIMESCALEDB_CACHE_INVALIDATE_H
#pragma once

#include <postgres.h>

extern void ts_cache_invalidate_set_proxy_tables(Oid hypertable_proxy_oid, Oid bgw_proxy_oid);

#endif /* TIMESCALEDB_CACHE_INVALIDATE_H */
5 changes: 1 addition & 4 deletions src/chunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#ifndef TIMESCALEDB_CHUNK_H
#define TIMESCALEDB_CHUNK_H
#pragma once

#include <postgres.h>
#include <access/htup.h>
Expand Down Expand Up @@ -330,5 +329,3 @@ extern TSDLLEXPORT void ts_chunk_merge_on_dimension(const Hypertable *ht, Chunk
extern TSDLLEXPORT bool ts_chunk_clear_status(Chunk *chunk, int32 status);
extern bool ts_osm_chunk_range_is_invalid(int64 range_start, int64 range_end);
extern int32 ts_chunk_get_osm_slice_id(int32 chunk_id, int32 time_dim_id);

#endif /* TIMESCALEDB_CHUNK_H */
5 changes: 1 addition & 4 deletions src/chunk_adaptive.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/*
* NOTE: adaptive chunking is still in BETA
*/
#ifndef TIMESCALEDB_CHUNK_ADAPTIVE_H
#define TIMESCALEDB_CHUNK_ADAPTIVE_H
#pragma once

#include <postgres.h>

Expand All @@ -28,5 +27,3 @@ extern void ts_chunk_sizing_func_validate(regproc func, ChunkSizingInfo *info);
extern TSDLLEXPORT ChunkSizingInfo *ts_chunk_sizing_info_get_default_disabled(Oid table_relid);

extern TSDLLEXPORT int64 ts_chunk_calculate_initial_chunk_target_size(void);

#endif /* TIMESCALEDB_CHUNK_ADAPTIVE_H */
5 changes: 1 addition & 4 deletions src/chunk_constraint.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#ifndef TIMESCALEDB_CHUNK_CONSTRAINT_H
#define TIMESCALEDB_CHUNK_CONSTRAINT_H
#pragma once

#include <postgres.h>
#include <nodes/pg_list.h>
Expand Down Expand Up @@ -89,5 +88,3 @@ extern ChunkConstraint *ts_chunk_constraints_add_from_tuple(ChunkConstraints *cc
extern ScanIterator ts_chunk_constraint_scan_iterator_create(MemoryContext result_mcxt);
extern void ts_chunk_constraint_scan_iterator_set_slice_id(ScanIterator *it, int32 slice_id);
extern void ts_chunk_constraint_scan_iterator_set_chunk_id(ScanIterator *it, int32 chunk_id);

#endif /* TIMESCALEDB_CHUNK_CONSTRAINT_H */
5 changes: 1 addition & 4 deletions src/chunk_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#ifndef TIMESCALEDB_CHUNK_INDEX_H
#define TIMESCALEDB_CHUNK_INDEX_H
#pragma once

#include <postgres.h>
#include <nodes/execnodes.h>
Expand Down Expand Up @@ -100,5 +99,3 @@ chunk_index_need_attnos_adjustment(TupleDesc htdesc, TupleDesc chunkdesc)
{
return chunk_index_columns_changed(htdesc->natts, chunkdesc);
}

#endif /* TIMESCALEDB_CHUNK_INDEX_H */
5 changes: 1 addition & 4 deletions src/chunk_scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#ifndef TIMESCALEDB_CHUNK_SCAN_H
#define TIMESCALEDB_CHUNK_SCAN_H
#pragma once

#include <postgres.h>

#include "hypertable.h"

extern Chunk **ts_chunk_scan_by_chunk_ids(const Hyperspace *hs, const List *chunk_ids,
unsigned int *num_chunks);

#endif /* TIMESCALEDB_CHUNK_SCAN_H */
5 changes: 1 addition & 4 deletions src/compat/compat-msvc-enter.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#ifndef TIMESCALEDB_COMPAT_MSVC_ENTER_H
#define TIMESCALEDB_COMPAT_MSVC_ENTER_H
#pragma once

#include <postgres.h>

Expand Down Expand Up @@ -43,5 +42,3 @@
#endif

#endif /* _MSC_VER */

#endif /* TIMESCALEDB_COMPAT_MSVC_ENTER_H */
5 changes: 1 addition & 4 deletions src/compat/compat-msvc-exit.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#ifndef TIMESCALEDB_COMPAT_MSVC_EXIT_H
#define TIMESCALEDB_COMPAT_MSVC_EXIT_H
#pragma once

/*
* Included after all files that need compatibility are included, this undoes
Expand All @@ -15,5 +14,3 @@
#undef PGDLLIMPORT
#define PGDLLIMPORT __declspec(dllexport)
#endif /* _MSC_VER */

#endif /* TIMESCALEDB_COMPAT_MSVC_EXIT_H */
5 changes: 1 addition & 4 deletions src/compat/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#ifndef TIMESCALEDB_COMPAT_H
#define TIMESCALEDB_COMPAT_H
#pragma once

#include <postgres.h>
#include <commands/cluster.h>
Expand Down Expand Up @@ -1059,5 +1058,3 @@ error_severity(int elevel)
return prefix;
}
#endif

#endif /* TIMESCALEDB_COMPAT_H */
6 changes: 2 additions & 4 deletions src/compression_with_clause.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#ifndef TIMESCALEDB_COMPRESSION_WITH_CLAUSE_H
#define TIMESCALEDB_COMPRESSION_WITH_CLAUSE_H
#pragma once

#include <postgres.h>
#include <catalog/pg_type.h>

Expand Down Expand Up @@ -38,5 +38,3 @@ extern TSDLLEXPORT List *ts_compress_hypertable_parse_order_by(WithClauseResult
extern TSDLLEXPORT Interval *
ts_compress_hypertable_parse_chunk_time_interval(WithClauseResult *parsed_options,
Hypertable *hypertable);

#endif
5 changes: 1 addition & 4 deletions src/constraint.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#ifndef TIMESCALEDB_CONSTRAINT_H
#define TIMESCALEDB_CONSTRAINT_H
#pragma once

#include <postgres.h>
#include <access/htup.h>
Expand All @@ -28,5 +27,3 @@ typedef enum ConstraintProcessStatus

typedef ConstraintProcessStatus (*constraint_func)(HeapTuple constraint_tuple, void *ctx);
extern TSDLLEXPORT int ts_constraint_process(Oid relid, constraint_func process_func, void *ctx);

#endif /* TIMESCALEDB_CONSTRAINT_H */