Commit e7812490 authored by Adrien Plazas's avatar Adrien Plazas Committed by Guido Günther

Normalize and document private header guards

parent 52249a12
......@@ -131,6 +131,17 @@ Header Inclusion Guards
Guard header inclusion with `#pragma once` rather than the traditional
`#ifndef`-`#define`-`#endif` trio.
Internal headers (for consistency, whether they need to be installed or not)
should contain the following guard to prevent users from directly including
them:
```c
#if !defined(_HANDY_INSIDE) && !defined(HANDY_COMPILATION)
#error "Only <handy.h> can be included directly."
#endif
```
Only after these should you include headers.
Signals
-------
......
......@@ -6,6 +6,10 @@
#pragma once
#if !defined(_HANDY_INSIDE) && !defined(HANDY_COMPILATION)
#error "Only <handy.h> can be included directly."
#endif
#include <gtk/gtk.h>
G_BEGIN_DECLS
......
......@@ -5,12 +5,12 @@
*/
#pragma once
#include "hdy-main.h"
#if !defined(_HANDY_INSIDE) && !defined(HANDY_COMPILATION)
#error "Only <handy.h> can be included directly."
#endif
#include "hdy-main.h"
G_BEGIN_DECLS
/* Initializes the public GObject types, which is needed to ensure they are
......
......@@ -5,12 +5,12 @@
*/
#pragma once
#include <glib.h>
#if !defined(_HANDY_INSIDE) && !defined(HANDY_COMPILATION)
#error "Only <handy.h> can be included directly."
#endif
#include <glib.h>
G_BEGIN_DECLS
gboolean hdy_init(int *argc, char ***argv);
......
......@@ -6,6 +6,10 @@
#pragma once
#if !defined(_HANDY_INSIDE) && !defined(HANDY_COMPILATION)
#error "Only <handy.h> can be included directly."
#endif
#include <gtk/gtk.h>
G_BEGIN_DECLS
......
Markdown is supported
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