Skip to contentSkip to conversation

Fix local #include to use quoted form

PATCH In review Simon Rozman 3 participants 3 messages Oct 12, 2017 – Nov 4, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix local #include to use quoted form

.h include files from the same folder or addressed relatively to the same folder should be #included using quoted form in MSVC. The angled form is reserved for include files from folders specified using /I path.

Using angled form, MSVC fails to locate local #include file, unless current folder is added to the include search path: /I .

---
 src/openvpnserv/common.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
src/openvpnserv/common.c +3 -2
index 0c9098f..e77d7ab 100644
@@ -21,8 +21,9 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <service.h>
-#include <validate.h>
+#include "service.h"
+#include "validate.h"
+
 /*
  * These are necessary due to certain buggy implementations of (v)snprintf,
  * that don't guarantee null termination for size > 0.
Signature · 10 lines
2.9.0.windows.1

This patch is a stand-alone fix, that was accidentaly included in
"[PATCH 06/13] openvpnserv.vcxproj project file recreated using Visual
Studio 2017".

I estimate this way it'll get better chance of being ACK-ed. :)

Best regards,
Simon
#1 lore raw

Hi,

Quoted 27 lines · Simon Rozman

.h include files from the same folder or addressed relatively to the same folder should be #included using quoted form in MSVC. The angled form is reserved for include files from folders specified using /I path.

Using angled form, MSVC fails to locate local #include file, unless current folder is added to the include search path: /I .

---
 src/openvpnserv/common.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
src/openvpnserv/common.c +3 -2
index 0c9098f..e77d7ab 100644
@@ -21,8 +21,9 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <service.h>
-#include <validate.h>
+#include "service.h"
+#include "validate.h"
+
 /*
  * These are necessary due to certain buggy implementations of
 (v)snprintf,
Quoted 2 lines

* that don't guarantee null termination for size > 0.

In mingw builds it works either way as our Makefile includes -I ./ as the first search path.
But conventionally quoted path is the right thing to use here.

ACK.

Selva

#2 lore raw
In reply to Simon Rozman

Your patch has been applied to the master and release/2.4 branch.

commit d2a7415f265aea5e0f04d80e48af506e153ba0f4 (master) commit c6af7006219ec03ece4545355251e79b47d56e8c (release/2.4)

Author: Simon Rozman
Date:   Thu Oct 12 12:34:48 2017 +0200
     Fix local #include to use quoted form

     Acked-by: Selva Nair <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg15622.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering