Commit f13eebcc authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari
Browse files

cpp: Use #pragma once instead of #ifndef guards

This both says what we mean and silences a bunch of spurious CPP linting
warnings. This pragma is supported by all CPP implementations which we
support.

Reviewers: austin, erikd, simonmar, hvr

Reviewed By: simonmar

Subscribers: rwbarton, thomie

Differential Revision: https://phabricator.haskell.org/D3482
parent 87fbf39a
#ifndef HSVERSIONS_H
#define HSVERSIONS_H
#pragma once
#if 0
......@@ -64,6 +63,3 @@ foreign import ccall unsafe saccessor \
#define ASSERTM(e) do { bool <- e; MASSERT(bool) }
#define ASSERTM2(e,msg) do { bool <- e; MASSERT2(bool,msg) }
#define WARNM2(e,msg) do { bool <- e; WARN(bool, msg) return () }
#endif /* HsVersions.h */
......@@ -6,9 +6,6 @@
-------------------------------------------------------------------------- */
#ifndef NCG_H
#define NCG_H
#pragma once
#include "ghc_boot_platform.h"
#endif
/* MD5 message digest */
#ifndef _MD5_H
#define _MD5_H
#pragma once
#include "HsFFI.h"
......@@ -17,8 +16,3 @@ void MD5Init(struct MD5Context *context);
void MD5Update(struct MD5Context *context, byte const *buf, int len);
void MD5Final(byte digest[16], struct MD5Context *context);
void MD5Transform(word32 buf[4], word32 const in[16]);
#endif /* _MD5_H */
#ifndef ISMINTTY_H
#define ISMINTTY_H
#pragma once
#include <stdbool.h>
bool isMinTTY();
#endif /* ISMINTTY_H */
......@@ -25,8 +25,7 @@
*
* -------------------------------------------------------------------------- */
#ifndef CMM_H
#define CMM_H
#pragma once
/*
* In files that are included into both C and C-- (and perhaps
......@@ -942,5 +941,3 @@
} \
\
return (dst);
#endif /* CMM_H */
......@@ -9,8 +9,7 @@
*
* ---------------------------------------------------------------------------*/
#ifndef HSFFI_H
#define HSFFI_H
#pragma once
#ifdef __cplusplus
extern "C" {
......@@ -122,5 +121,3 @@ extern void hs_try_putmvar (int capability, HsStablePtr sp);
#ifdef __cplusplus
}
#endif
#endif /* HSFFI_H */
......@@ -13,8 +13,7 @@
*
* ---------------------------------------------------------------------------*/
#ifndef MACHDEPS_H
#define MACHDEPS_H
#pragma once
/* Don't allow stage1 (cross-)compiler embed assumptions about target
* platform. When ghc-stage1 is being built by ghc-stage0 is should not
......@@ -122,5 +121,3 @@
#define TAG_MASK ((1 << TAG_BITS) - 1)
#endif /* !defined(STAGE) || STAGE >= 2 */
#endif /* MACHDEPS_H */
......@@ -10,8 +10,7 @@
*
* ---------------------------------------------------------------------------*/
#ifndef RTS_H
#define RTS_H
#pragma once
#ifdef __cplusplus
extern "C" {
......@@ -313,5 +312,3 @@ TICK_VAR(2)
#ifdef __cplusplus
}
#endif
#endif /* RTS_H */
......@@ -9,8 +9,7 @@
*
* --------------------------------------------------------------------------*/
#ifndef RTSAPI_H
#define RTSAPI_H
#pragma once
#ifdef __cplusplus
extern "C" {
......@@ -445,5 +444,3 @@ extern StgWord base_GHCziTopHandler_runNonIO_closure[];
#ifdef __cplusplus
}
#endif
#endif /* RTSAPI_H */
......@@ -23,8 +23,7 @@
*
* ---------------------------------------------------------------------------*/
#ifndef STG_H
#define STG_H
#pragma once
#if !(__STDC_VERSION__ >= 199901L)
# error __STDC_VERSION__ does not advertise C99 or later
......@@ -567,5 +566,3 @@ typedef union {
c; \
})
#endif
#endif /* STG_H */
#ifndef __GHCCONFIG_H__
#define __GHCCONFIG_H__
#pragma once
#include "ghcautoconf.h"
#include "ghcplatform.h"
#endif
......@@ -11,8 +11,7 @@
*
* -------------------------------------------------------------------------- */
#ifndef RTS_ADJUSTOR_H
#define RTS_ADJUSTOR_H
#pragma once
/* Creating and destroying an adjustor thunk */
void* createAdjustor (int cconv,
......@@ -21,5 +20,3 @@ void* createAdjustor (int cconv,
char *typeString);
void freeHaskellFunctionPtr (void* ptr);
#endif /* RTS_ADJUSTOR_H */
......@@ -11,8 +11,7 @@
*
* ---------------------------------------------------------------------------*/
#ifndef RTS_BLOCKSIGNALS_H
#define RTS_BLOCKSIGNALS_H
#pragma once
/* Used by runProcess() in the process package
*/
......@@ -33,5 +32,3 @@ void blockUserSignals(void);
* The inverse of blockUserSignals(); re-enable the deliver of console events.
*/
void unblockUserSignals(void);
#endif /* RTS_BLOCKSIGNALS_H */
......@@ -13,8 +13,7 @@
*
* ---------------------------------------------------------------------------*/
#ifndef RTS_CONFIG_H
#define RTS_CONFIG_H
#pragma once
#if defined(TICKY_TICKY) && defined(THREADED_RTS)
#error TICKY_TICKY is incompatible with THREADED_RTS
......@@ -47,5 +46,3 @@
/* Profile spin locks */
#define PROF_SPIN
#endif /* RTS_CONFIG_H */
......@@ -17,8 +17,7 @@
*
* -------------------------------------------------------------------------- */
#ifndef RTS_CONSTANTS_H
#define RTS_CONSTANTS_H
#pragma once
/* -----------------------------------------------------------------------------
Minimum closure sizes
......@@ -314,5 +313,3 @@
* we can have static arrays of this size in the RTS for speed.
*/
#define MAX_NUMA_NODES 16
#endif /* RTS_CONSTANTS_H */
......@@ -73,8 +73,7 @@
*
* -------------------------------------------------------------------------- */
#ifndef RTS_EVENTLOGFORMAT_H
#define RTS_EVENTLOGFORMAT_H
#pragma once
/*
* Markers for begin/end of the Header.
......@@ -245,5 +244,3 @@ typedef StgWord64 EventTaskId; /* for EVENT_TASK_* */
typedef StgWord64 EventKernelThreadId; /* for EVENT_TASK_CREATE */
#endif
#endif /* RTS_EVENTLOGFORMAT_H */
......@@ -6,8 +6,7 @@
*
* ---------------------------------------------------------------------------*/
#ifndef EVENTLOG_WRITER_H
#define EVENTLOG_WRITER_H
#pragma once
#include <stddef.h>
#include <stdbool.h>
......@@ -36,5 +35,3 @@ typedef struct {
* a file `program.eventlog`.
*/
extern const EventLogWriter FileEventLogWriter;
#endif /* EVENTLOG_WRITER_H */
......@@ -11,12 +11,9 @@
*
* ---------------------------------------------------------------------------*/
#ifndef RTS_FILELOCK_H
#define RTS_FILELOCK_H
#pragma once
#include "Stg.h"
int lockFile(int fd, StgWord64 dev, StgWord64 ino, int for_writing);
int unlockFile(int fd);
#endif /* RTS_FILELOCK_H */
......@@ -11,8 +11,7 @@
*
* ---------------------------------------------------------------------------*/
#ifndef RTS_FLAGS_H
#define RTS_FLAGS_H
#pragma once
#include <stdio.h>
#include <stdint.h>
......@@ -282,5 +281,3 @@ extern char **prog_argv;
*/
extern int rts_argc; /* ditto */
extern char **rts_argv;
#endif /* RTS_FLAGS_H */
......@@ -11,9 +11,6 @@
*
* ---------------------------------------------------------------------------*/
#ifndef RTS_GETTIME_H
#define RTS_GETTIME_H
#pragma once
StgWord64 getMonotonicNSec (void);
#endif /* RTS_GETTIME_H */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment