{"id":2214,"url":"https://patchwork.libcamera.org/api/patches/2214/?format=json","web_url":"https://patchwork.libcamera.org/patch/2214/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20191023135258.32256-4-laurent.pinchart@ideasonboard.com>","date":"2019-10-23T13:52:58","name":"[libcamera-devel,4/4] libcamera: Standardise on C compatibility headers","commit_ref":"ca260d2f5337536e30d1b2501434bd2a93a3e72e","pull_url":null,"state":"accepted","archived":false,"hash":"3d1c4efe206cdf8030899eebafa9d9d793b12353","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2214/mbox/","series":[{"id":543,"url":"https://patchwork.libcamera.org/api/series/543/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=543","date":"2019-10-23T13:52:55","name":"[libcamera-devel,1/4] Documentation: coding-style: Document usage of C compatibility headers","version":1,"mbox":"https://patchwork.libcamera.org/series/543/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2214/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2214/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 95DC96138B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Oct 2019 15:54:01 +0200 (CEST)","from pendragon.ideasonboard.com (143.121.2.93.rev.sfr.net\n\t[93.2.121.143])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 465C971F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Oct 2019 15:54:01 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1571838841;\n\tbh=4WxC05OZFfV/oLQL/ZJLIbyvjLLOd8U6xruAJjZ1tg4=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=bkcx0eyqPAErTuFbK2Itz51v+im7+jEGfxdauF0JxMGNVYK72OeoXKRipCUT/0UBm\n\tC1OlOvgTgVg6VPg6BSWaTNX3NyVhYRNdNn9E1egEfCN8X74O3bZ2dhc1fQUtCmUV5b\n\tlndJ/qYMFVwtVCWvDloqFj97qtV8gnngbP2pz2VI=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 23 Oct 2019 16:52:58 +0300","Message-Id":"<20191023135258.32256-4-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.23.0","In-Reply-To":"<20191023135258.32256-1-laurent.pinchart@ideasonboard.com>","References":"<20191023135258.32256-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 4/4] libcamera: Standardise on C\n\tcompatibility headers","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Wed, 23 Oct 2019 13:54:01 -0000"},"content":"Now that our usage of C compatibility header is documented, use them\nconsistently through the source code. While at it, group the C and C++\ninclude statements, and fix a handful of #include ordering issues.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/timer.h                     | 2 +-\n src/cam/capture.cpp                           | 2 +-\n src/cam/options.cpp                           | 2 +-\n src/ipa/rkisp1/rkisp1.cpp                     | 2 +-\n src/libcamera/device_enumerator_udev.cpp      | 5 ++---\n src/libcamera/include/event_dispatcher_poll.h | 4 ++--\n src/libcamera/include/ipc_unixsocket.h        | 2 +-\n src/libcamera/log.cpp                         | 6 +++---\n src/libcamera/media_device.cpp                | 3 +--\n src/libcamera/media_object.cpp                | 3 +--\n src/libcamera/stream.cpp                      | 2 +-\n test/ipa/ipa_interface_test.cpp               | 3 +--\n test/media_device/media_device_print_test.cpp | 2 +-\n test/pipeline/ipu3/ipu3_pipeline_test.cpp     | 1 -\n test/v4l2_subdevice/test_formats.cpp          | 2 +-\n test/v4l2_videodevice/capture_async.cpp       | 4 ++--\n test/v4l2_videodevice/controls.cpp            | 2 +-\n test/v4l2_videodevice/formats.cpp             | 2 +-\n 18 files changed, 22 insertions(+), 27 deletions(-)","diff":"diff --git a/include/libcamera/timer.h b/include/libcamera/timer.h\nindex 34e7b8ac8e87..f55fe3c09660 100644\n--- a/include/libcamera/timer.h\n+++ b/include/libcamera/timer.h\n@@ -8,7 +8,7 @@\n #define __LIBCAMERA_TIMER_H__\n \n #include <chrono>\n-#include <cstdint>\n+#include <stdint.h>\n \n #include <libcamera/object.h>\n #include <libcamera/signal.h>\ndiff --git a/src/cam/capture.cpp b/src/cam/capture.cpp\nindex 8a939c622703..d05c01f1b13e 100644\n--- a/src/cam/capture.cpp\n+++ b/src/cam/capture.cpp\n@@ -6,9 +6,9 @@\n  */\n \n #include <chrono>\n-#include <climits>\n #include <iomanip>\n #include <iostream>\n+#include <limits.h>\n #include <sstream>\n \n #include \"capture.h\"\ndiff --git a/src/cam/options.cpp b/src/cam/options.cpp\nindex 7c3948df3b5c..1f0631eccfba 100644\n--- a/src/cam/options.cpp\n+++ b/src/cam/options.cpp\n@@ -5,7 +5,7 @@\n  * options.cpp - cam - Options parsing\n  */\n \n-#include <cassert>\n+#include <assert.h>\n #include <getopt.h>\n #include <iomanip>\n #include <iostream>\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 570145ce71b2..9a13f5c7df17 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -6,9 +6,9 @@\n  */\n \n #include <algorithm>\n-#include <cstdint>\n #include <math.h>\n #include <queue>\n+#include <stdint.h>\n #include <string.h>\n \n #include <linux/rkisp1-config.h>\ndiff --git a/src/libcamera/device_enumerator_udev.cpp b/src/libcamera/device_enumerator_udev.cpp\nindex ddcd59ea52c1..b2c5fd221dcd 100644\n--- a/src/libcamera/device_enumerator_udev.cpp\n+++ b/src/libcamera/device_enumerator_udev.cpp\n@@ -8,11 +8,10 @@\n #include \"device_enumerator_udev.h\"\n \n #include <algorithm>\n-#include <list>\n-#include <map>\n-\n #include <fcntl.h>\n #include <libudev.h>\n+#include <list>\n+#include <map>\n #include <string.h>\n #include <sys/ioctl.h>\n #include <sys/sysmacros.h>\ndiff --git a/src/libcamera/include/event_dispatcher_poll.h b/src/libcamera/include/event_dispatcher_poll.h\nindex d82b302c4aea..1f0738617425 100644\n--- a/src/libcamera/include/event_dispatcher_poll.h\n+++ b/src/libcamera/include/event_dispatcher_poll.h\n@@ -7,12 +7,12 @@\n #ifndef __LIBCAMERA_EVENT_DISPATCHER_POLL_H__\n #define __LIBCAMERA_EVENT_DISPATCHER_POLL_H__\n \n-#include <libcamera/event_dispatcher.h>\n-\n #include <list>\n #include <map>\n #include <vector>\n \n+#include <libcamera/event_dispatcher.h>\n+\n struct pollfd;\n \n namespace libcamera {\ndiff --git a/src/libcamera/include/ipc_unixsocket.h b/src/libcamera/include/ipc_unixsocket.h\nindex 03e9fe492bde..820d05611049 100644\n--- a/src/libcamera/include/ipc_unixsocket.h\n+++ b/src/libcamera/include/ipc_unixsocket.h\n@@ -8,7 +8,7 @@\n #ifndef __LIBCAMERA_IPC_UNIXSOCKET_H__\n #define __LIBCAMERA_IPC_UNIXSOCKET_H__\n \n-#include <cstdint>\n+#include <stdint.h>\n #include <sys/types.h>\n #include <vector>\n \ndiff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp\nindex 51f9f86b4c44..50f345b98c74 100644\n--- a/src/libcamera/log.cpp\n+++ b/src/libcamera/log.cpp\n@@ -7,14 +7,14 @@\n \n #include \"log.h\"\n \n-#include <cstdio>\n-#include <cstdlib>\n-#include <ctime>\n #include <fstream>\n #include <iostream>\n #include <list>\n+#include <stdio.h>\n+#include <stdlib.h>\n #include <string.h>\n #include <syslog.h>\n+#include <time.h>\n #include <unordered_set>\n \n #include <libcamera/logging.h>\ndiff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp\nindex bd99deba098d..0d6630fbd1f4 100644\n--- a/src/libcamera/media_device.cpp\n+++ b/src/libcamera/media_device.cpp\n@@ -9,11 +9,10 @@\n \n #include <errno.h>\n #include <fcntl.h>\n+#include <string>\n #include <string.h>\n #include <sys/ioctl.h>\n #include <unistd.h>\n-\n-#include <string>\n #include <vector>\n \n #include <linux/media.h>\ndiff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp\nindex 8794ff4578c9..ef32065c161d 100644\n--- a/src/libcamera/media_object.cpp\n+++ b/src/libcamera/media_object.cpp\n@@ -8,10 +8,9 @@\n #include \"media_object.h\"\n \n #include <errno.h>\n+#include <string>\n #include <string.h>\n #include <unistd.h>\n-\n-#include <string>\n #include <vector>\n \n #include <linux/media.h>\ndiff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\nindex 610920d1e5b3..b8e7209c1047 100644\n--- a/src/libcamera/stream.cpp\n+++ b/src/libcamera/stream.cpp\n@@ -9,8 +9,8 @@\n \n #include <algorithm>\n #include <array>\n-#include <climits>\n #include <iomanip>\n+#include <limits.h>\n #include <sstream>\n \n #include <libcamera/request.h>\ndiff --git a/test/ipa/ipa_interface_test.cpp b/test/ipa/ipa_interface_test.cpp\nindex 0bdeb167a675..cafc249bbbc9 100644\n--- a/test/ipa/ipa_interface_test.cpp\n+++ b/test/ipa/ipa_interface_test.cpp\n@@ -6,13 +6,12 @@\n  */\n \n #include <fcntl.h>\n+#include <iostream>\n #include <string.h>\n #include <sys/stat.h>\n #include <sys/types.h>\n #include <unistd.h>\n \n-#include <iostream>\n-\n #include <libcamera/event_dispatcher.h>\n #include <libcamera/event_notifier.h>\n #include <libcamera/timer.h>\ndiff --git a/test/media_device/media_device_print_test.cpp b/test/media_device/media_device_print_test.cpp\nindex 30d929b8c763..8dd8a151266d 100644\n--- a/test/media_device/media_device_print_test.cpp\n+++ b/test/media_device/media_device_print_test.cpp\n@@ -4,8 +4,8 @@\n  *\n  * media_device_print_test.cpp - Print out media devices\n  */\n-#include <iostream>\n \n+#include <iostream>\n #include <sys/types.h>\n #include <sys/stat.h>\n #include <unistd.h>\ndiff --git a/test/pipeline/ipu3/ipu3_pipeline_test.cpp b/test/pipeline/ipu3/ipu3_pipeline_test.cpp\nindex 8bfcd609a071..a5c6be0955df 100644\n--- a/test/pipeline/ipu3/ipu3_pipeline_test.cpp\n+++ b/test/pipeline/ipu3/ipu3_pipeline_test.cpp\n@@ -6,7 +6,6 @@\n  */\n \n #include <iostream>\n-\n #include <sys/stat.h>\n #include <sys/types.h>\n #include <unistd.h>\ndiff --git a/test/v4l2_subdevice/test_formats.cpp b/test/v4l2_subdevice/test_formats.cpp\nindex e90c2c2426da..5cf5d5664b04 100644\n--- a/test/v4l2_subdevice/test_formats.cpp\n+++ b/test/v4l2_subdevice/test_formats.cpp\n@@ -5,8 +5,8 @@\n  * libcamera V4L2 Subdevice format handling test\n  */\n \n-#include <climits>\n #include <iostream>\n+#include <limits.h>\n \n #include \"v4l2_subdevice.h\"\n #include \"v4l2_subdevice_test.h\"\ndiff --git a/test/v4l2_videodevice/capture_async.cpp b/test/v4l2_videodevice/capture_async.cpp\nindex 17eb528b12fd..442a4fe56eac 100644\n--- a/test/v4l2_videodevice/capture_async.cpp\n+++ b/test/v4l2_videodevice/capture_async.cpp\n@@ -5,12 +5,12 @@\n  * libcamera V4L2 API tests\n  */\n \n+#include <iostream>\n+\n #include <libcamera/buffer.h>\n #include <libcamera/event_dispatcher.h>\n #include <libcamera/timer.h>\n \n-#include <iostream>\n-\n #include \"thread.h\"\n #include \"v4l2_videodevice_test.h\"\n \ndiff --git a/test/v4l2_videodevice/controls.cpp b/test/v4l2_videodevice/controls.cpp\nindex 975c852b8cbf..42c653d4435a 100644\n--- a/test/v4l2_videodevice/controls.cpp\n+++ b/test/v4l2_videodevice/controls.cpp\n@@ -5,8 +5,8 @@\n  * controls.cpp - V4L2 device controls handling test\n  */\n \n-#include <climits>\n #include <iostream>\n+#include <limits.h>\n \n #include \"v4l2_videodevice.h\"\n \ndiff --git a/test/v4l2_videodevice/formats.cpp b/test/v4l2_videodevice/formats.cpp\nindex ee7d357de075..d504d1788d02 100644\n--- a/test/v4l2_videodevice/formats.cpp\n+++ b/test/v4l2_videodevice/formats.cpp\n@@ -5,8 +5,8 @@\n  * libcamera V4L2 device format handling test\n  */\n \n-#include <climits>\n #include <iostream>\n+#include <limits.h>\n \n #include \"v4l2_videodevice.h\"\n \n","prefixes":["libcamera-devel","4/4"]}