[Replicant] [libsamsung-ipc] [PATCH 3/4] samsung-ipc: use #include "file" instead of #include <file> when relevant

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Wed Jul 15 17:12:39 UTC 2020


The way <> and "" are included are implementation defined according to
the C18 standard[1]:
    A preprocessing directive of the form
    # include < h-char-sequence > new-line
    searches a sequence of implementation-defined places for a header
    identified uniquely by the specified sequence between the < and >
    delimiters, and causes the replacement of that directive by the entire
    contents of the header. How the places are specified or the header
    identified is implementation-defined.

    A preprocessing directive of the form
    # include " q-char-sequence " new-line
    causes the replacement of that directive by the entire contents of the
    source file identified by the specified sequence between the "
    delimiters. The named source file is searched for in an
    implementation-defined manner. If this search is not supported, or if
    the search fails, the directive is reprocessed as if it read

And the GCC documentation has the following on #include directives[2]:
    Both user and system header files are included using the preprocessing
    directive ‘#include’. It has two variants:
    #include <file>
    This variant is used for system header files. It searches for a file
    named file in a standard list of system directories. You can prepend
     directories to this list with the -I option (see Invocation).

    #include "file"
    This variant is used for header files of your own program. It searches
    for a file named file first in the directory containing the current
    file, then in the quote directories and then the same directories used
    for <file>. You can prepend directories to the list of quote
    directories with the -iquote option.

References:
-----------
[1]The standard doesn't seem to be available for free, but the draft
   can be downloaded from the following URL:
   https://web.archive.org/web/20181230041359if_/http://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf
[2]https://gcc.gnu.org/onlinedocs/cpp/Include-Syntax.html

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
---
 samsung-ipc/devices/aries/aries.c                  | 2 +-
 samsung-ipc/devices/crespo/crespo.c                | 2 +-
 samsung-ipc/devices/galaxys2/galaxys2.c            | 2 +-
 samsung-ipc/devices/i9300/i9300.c                  | 2 +-
 samsung-ipc/devices/ipc_devices.c                  | 3 ++-
 samsung-ipc/devices/maguro/maguro.c                | 2 +-
 samsung-ipc/devices/n5100/n5100.c                  | 2 +-
 samsung-ipc/devices/n7100/n7100.c                  | 2 +-
 samsung-ipc/devices/piranha/piranha.c              | 2 +-
 samsung-ipc/ipc.c                                  | 4 ++--
 samsung-ipc/ipc_utils.c                            | 3 ++-
 samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.c | 7 +++----
 samsung-ipc/rfs.c                                  | 2 +-
 13 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/samsung-ipc/devices/aries/aries.c b/samsung-ipc/devices/aries/aries.c
index 75576d4..409d2f8 100644
--- a/samsung-ipc/devices/aries/aries.c
+++ b/samsung-ipc/devices/aries/aries.c
@@ -32,10 +32,10 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <ipc.h>
 #include <samsung-ipc.h>
 
 #include "aries.h"
+#include "ipc.h"
 #include "onedram.h"
 #include "phonet.h"
 #include "xmm616.h"
diff --git a/samsung-ipc/devices/crespo/crespo.c b/samsung-ipc/devices/crespo/crespo.c
index 5aec9c4..80b8f4a 100644
--- a/samsung-ipc/devices/crespo/crespo.c
+++ b/samsung-ipc/devices/crespo/crespo.c
@@ -29,11 +29,11 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <ipc.h>
 #include <samsung-ipc.h>
 
 #include "crespo.h"
 #include "crespo_modem_ctl.h"
+#include "ipc.h"
 #include "xmm616.h"
 
 int crespo_boot(struct ipc_client *client)
diff --git a/samsung-ipc/devices/galaxys2/galaxys2.c b/samsung-ipc/devices/galaxys2/galaxys2.c
index b0bac5f..d137950 100644
--- a/samsung-ipc/devices/galaxys2/galaxys2.c
+++ b/samsung-ipc/devices/galaxys2/galaxys2.c
@@ -23,10 +23,10 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <ipc.h>
 #include <samsung-ipc.h>
 
 #include "galaxys2.h"
+#include "ipc.h"
 #include "xmm626.h"
 #include "xmm626_hsic.h"
 #include "xmm626_kernel_smdk4412.h"
diff --git a/samsung-ipc/devices/i9300/i9300.c b/samsung-ipc/devices/i9300/i9300.c
index 19137de..f7da6f8 100644
--- a/samsung-ipc/devices/i9300/i9300.c
+++ b/samsung-ipc/devices/i9300/i9300.c
@@ -23,10 +23,10 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <ipc.h>
 #include <samsung-ipc.h>
 
 #include "i9300.h"
+#include "ipc.h"
 #include "xmm626.h"
 #include "xmm626_hsic.h"
 #include "xmm626_kernel_smdk4412.h"
diff --git a/samsung-ipc/devices/ipc_devices.c b/samsung-ipc/devices/ipc_devices.c
index c94d030..73f2914 100644
--- a/samsung-ipc/devices/ipc_devices.c
+++ b/samsung-ipc/devices/ipc_devices.c
@@ -20,7 +20,8 @@
 #include <stdlib.h>
 
 #include <samsung-ipc.h>
-#include <ipc_devices.h>
+
+#include "ipc_devices.h"
 
 struct ipc_device_desc ipc_devices[] = {
 	{
diff --git a/samsung-ipc/devices/maguro/maguro.c b/samsung-ipc/devices/maguro/maguro.c
index 0b24059..a4416ba 100644
--- a/samsung-ipc/devices/maguro/maguro.c
+++ b/samsung-ipc/devices/maguro/maguro.c
@@ -24,9 +24,9 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <ipc.h>
 #include <samsung-ipc.h>
 
+#include "ipc.h"
 #include "maguro.h"
 #include "xmm626.h"
 #include "xmm626_mipi.h"
diff --git a/samsung-ipc/devices/n5100/n5100.c b/samsung-ipc/devices/n5100/n5100.c
index 15af41c..8cc8fb5 100644
--- a/samsung-ipc/devices/n5100/n5100.c
+++ b/samsung-ipc/devices/n5100/n5100.c
@@ -24,9 +24,9 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <ipc.h>
 #include <samsung-ipc.h>
 
+#include "ipc.h"
 #include "n5100.h"
 #include "xmm626.h"
 #include "xmm626_hsic.h"
diff --git a/samsung-ipc/devices/n7100/n7100.c b/samsung-ipc/devices/n7100/n7100.c
index e1ff774..d6ce946 100644
--- a/samsung-ipc/devices/n7100/n7100.c
+++ b/samsung-ipc/devices/n7100/n7100.c
@@ -23,9 +23,9 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <ipc.h>
 #include <samsung-ipc.h>
 
+#include "ipc.h"
 #include "n7100.h"
 #include "xmm626.h"
 #include "xmm626_hsic.h"
diff --git a/samsung-ipc/devices/piranha/piranha.c b/samsung-ipc/devices/piranha/piranha.c
index 56dc60b..fe93f0f 100644
--- a/samsung-ipc/devices/piranha/piranha.c
+++ b/samsung-ipc/devices/piranha/piranha.c
@@ -23,9 +23,9 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <ipc.h>
 #include <samsung-ipc.h>
 
+#include "ipc.h"
 #include "piranha.h"
 #include "xmm626.h"
 #include "xmm626_mipi.h"
diff --git a/samsung-ipc/ipc.c b/samsung-ipc/ipc.c
index 48c0450..a815f58 100644
--- a/samsung-ipc/ipc.c
+++ b/samsung-ipc/ipc.c
@@ -38,8 +38,8 @@
 
 #include <samsung-ipc.h>
 
-#include <ipc.h>
-#include <ipc_devices.h>
+#include "ipc.h"
+#include "ipc_devices.h"
 
 int ipc_device_detect(void)
 {
diff --git a/samsung-ipc/ipc_utils.c b/samsung-ipc/ipc_utils.c
index 0aed7ec..d8b69b7 100644
--- a/samsung-ipc/ipc_utils.c
+++ b/samsung-ipc/ipc_utils.c
@@ -30,7 +30,8 @@
 #include <asm/types.h>
 
 #include <samsung-ipc.h>
-#include <ipc.h>
+
+#include "ipc.h"
 
 int ipc_seq_valid(unsigned char seq)
 {
diff --git a/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.c b/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.c
index 275a9ef..3820706 100644
--- a/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.c
+++ b/samsung-ipc/modems/xmm626/xmm626_kernel_smdk4412.c
@@ -28,13 +28,12 @@
 #include <sys/select.h>
 
 #include <samsung-ipc.h>
-#include <ipc.h>
-
-#include "xmm626_modem_prj.h"
-#include "xmm626_modem_link_device_hsic.h"
 
+#include "ipc.h"
 #include "xmm626.h"
 #include "xmm626_kernel_smdk4412.h"
+#include "xmm626_modem_link_device_hsic.h"
+#include "xmm626_modem_prj.h"
 
 int xmm626_kernel_smdk4412_power(
 	__attribute__((unused)) struct ipc_client *client, int device_fd,
diff --git a/samsung-ipc/rfs.c b/samsung-ipc/rfs.c
index f57c32e..114df99 100644
--- a/samsung-ipc/rfs.c
+++ b/samsung-ipc/rfs.c
@@ -30,7 +30,7 @@
 
 #include <samsung-ipc.h>
 
-#include <ipc.h>
+#include "ipc.h"
 
 char *ipc_nv_data_md5_calculate(struct ipc_client *client,
 				const char *path, const char *secret,
-- 
2.27.0



More information about the Replicant mailing list