Commit e7812490 authored by Adrien Plazas's avatar Adrien Plazas Committed by Guido Gunther

Normalize and document private header guards

parent 52249a12
...@@ -131,6 +131,17 @@ Header Inclusion Guards ...@@ -131,6 +131,17 @@ Header Inclusion Guards
Guard header inclusion with `#pragma once` rather than the traditional Guard header inclusion with `#pragma once` rather than the traditional
`#ifndef`-`#define`-`#endif` trio. `#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 Signals
------- -------
......
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
#pragma once #pragma once
#if !defined(_HANDY_INSIDE) && !defined(HANDY_COMPILATION)
#error "Only <handy.h> can be included directly."
#endif
#include <gtk/gtk.h> #include <gtk/gtk.h>
G_BEGIN_DECLS G_BEGIN_DECLS
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
*/ */
#pragma once #pragma once
#include "hdy-main.h"
#if !defined(_HANDY_INSIDE) && !defined(HANDY_COMPILATION) #if !defined(_HANDY_INSIDE) && !defined(HANDY_COMPILATION)
#error "Only <handy.h> can be included directly." #error "Only <handy.h> can be included directly."
#endif #endif
#include "hdy-main.h"
G_BEGIN_DECLS G_BEGIN_DECLS
/* Initializes the public GObject types, which is needed to ensure they are /* Initializes the public GObject types, which is needed to ensure they are
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
*/ */
#pragma once #pragma once
#include <glib.h>
#if !defined(_HANDY_INSIDE) && !defined(HANDY_COMPILATION) #if !defined(_HANDY_INSIDE) && !defined(HANDY_COMPILATION)
#error "Only <handy.h> can be included directly." #error "Only <handy.h> can be included directly."
#endif #endif
#include <glib.h>
G_BEGIN_DECLS G_BEGIN_DECLS
gboolean hdy_init(int *argc, char ***argv); gboolean hdy_init(int *argc, char ***argv);
......
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
#pragma once #pragma once
#if !defined(_HANDY_INSIDE) && !defined(HANDY_COMPILATION)
#error "Only <handy.h> can be included directly."
#endif
#include <gtk/gtk.h> #include <gtk/gtk.h>
G_BEGIN_DECLS 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