Ok, 100% of votes are for the removal of wired #includes.
Here is the patch.  Tests are changed accordingly.

Thierry


Le 30/03/2015 16:39, Nick Dokos a écrit :
>
> IMO, it would be better than the current situation, but I wonder if
> it makes sense to have a global default setting containing the
> three files, but one which the user can customize; any :includes
> parameters would augment the default.
>
> That would satisfy the OP's requirements, but would also allow for
> a shorter #+BEGIN_SRC line.
>
> Nick
>
>

>From 89eab423a0084a715456db558a987d6d806c49ba Mon Sep 17 00:00:00 2001
From: Thierry Banel <tbanelweb...@free.fr>
Date: Mon, 30 Mar 2015 21:36:00 +0200
Subject: [PATCH] Remove default #includes in Babel C, C++

* ob-C.el (org-babel-C-expand-C): remove automatic inclusion
of <string.h>, <stdio.h>, <stdlib.h>

* ob-C-test.org: adjust C++ tests to manually include
required header files.
---
 lisp/ob-C.el                   | 1 -
 testing/examples/ob-C-test.org | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/lisp/ob-C.el b/lisp/ob-C.el
index 0857795..8d5ff2f 100644
--- a/lisp/ob-C.el
+++ b/lisp/ob-C.el
@@ -194,7 +194,6 @@ it's header arguments."
 		  nil)))
     (when (stringp includes)
       (setq includes (split-string includes)))
-    (setq includes (append includes '("<string.h>" "<stdio.h>" "<stdlib.h>")))
     (when (stringp defines)
       (let ((y nil)
 	    (result (list t)))
diff --git a/testing/examples/ob-C-test.org b/testing/examples/ob-C-test.org
index ab744f1..dcd1c48 100644
--- a/testing/examples/ob-C-test.org
+++ b/testing/examples/ob-C-test.org
@@ -129,7 +129,7 @@
   | sunday    |    4 |
 
 #+source: inhomogeneous_table
-#+begin_src cpp :var tinomogen=tinomogen :results silent
+#+begin_src cpp :var tinomogen=tinomogen :results silent :includes <string.h> <stdio.h>
 int main()
 {
   int i, j;
-- 
2.1.4

Reply via email to