]> sigrok.org Git - sigrok-cli.git/commitdiff
Fix a bunch of compiler warnings.
authorUwe Hermann <redacted>
Tue, 19 Nov 2013 10:48:06 +0000 (11:48 +0100)
committerUwe Hermann <redacted>
Tue, 19 Nov 2013 10:51:11 +0000 (11:51 +0100)
We need to ensure that libsigrokdecode.h is always the first #include,
otherwise some versions of Python will cause all kinds of compiler
warnings like these:

  CC       device.o
In file included from /usr/include/python3.2mu/Python.h:8:0,
                 from [...]/include/libsigrokdecode/libsigrokdecode.h:25,
                 from sigrok-cli.h:26,
                 from device.c:23:
/usr/include/python3.2mu/pyconfig.h:1182:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
 #define _POSIX_C_SOURCE 200112L
 ^
In file included from /usr/include/limits.h:26:0,
                 from /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed/limits.h:168,
                 from /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed/syslimits.h:7,
                 from /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed/limits.h:34,
                 from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:11,
                 from /usr/include/glib-2.0/glib/gtypes.h:34,
                 from /usr/include/glib-2.0/glib/galloca.h:34,
                 from /usr/include/glib-2.0/glib.h:32,
                 from device.c:21:
/usr/include/features.h:231:0: note: this is the location of the previous definition
 #  define _POSIX_C_SOURCE 200809L
 ^

Since sigrok-cli.h already #includes libsigrok.h and libsigrokdecode.h,
just ensure that the latter is always the first #include by _only_
including it in sigrok-cli.h and nowhere else.

anykey.c
decode.c
device.c
input.c
main.c
parsers.c
session.c
show.c
sigrok-cli.h

index 24970c2c299a26733dc754a34a3c586925367be5..f11b0d7b031a4a3f94deefad037c861f828cdfc7 100644 (file)
--- a/anykey.c
+++ b/anykey.c
@@ -17,6 +17,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "sigrok-cli.h"
 #include <stdio.h>
 #ifdef _WIN32
 #include <windows.h>
@@ -26,8 +27,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <glib.h>
-#include <libsigrok/libsigrok.h>
-#include "sigrok-cli.h"
 
 #ifdef _WIN32
 static HANDLE stdin_handle;
index 28b156b45c03050931cd6f11e915fd632192248d..bc36a843546281648e68f11883c39b9389af0cb8 100644 (file)
--- a/decode.c
+++ b/decode.c
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "sigrok-cli.h"
 #include "config.h"
 #include <glib.h>
-#include <libsigrok/libsigrok.h>
-#ifdef HAVE_SRD
-#include <libsigrokdecode/libsigrokdecode.h> /* First, so we avoid a _POSIX_C_SOURCE warning. */
-#endif
-#include "sigrok-cli.h"
 
 #ifdef HAVE_SRD
 static GHashTable *pd_ann_visible = NULL;
index 2dc830817df44c4eab739421a275b269e4a73a1b..28184ce1e5451e732b410fa1ffc9eaefd1a0c456 100644 (file)
--- a/device.c
+++ b/device.c
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "sigrok-cli.h"
 #include "config.h"
 #include <glib.h>
-#include <libsigrok/libsigrok.h>
-#include "sigrok-cli.h"
 
 extern struct sr_context *sr_ctx;
 extern gchar *opt_drv;
diff --git a/input.c b/input.c
index 7ef694d4bad2e9a3a429d4debc68fe593d698cdc..5650b9f8d1a317644c32f537f91bbf714a86a054 100644 (file)
--- a/input.c
+++ b/input.c
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "sigrok-cli.h"
 #include "config.h"
 #include <glib.h>
-#include <libsigrok/libsigrok.h>
-#include "sigrok-cli.h"
 
 extern gchar *opt_input_file;
 extern gchar *opt_input_format;
diff --git a/main.c b/main.c
index abacea964830707dbe30a5fc34f0006e078b3731..9ab3f77cc49baa64dae8e72e1a44ab19b841fb0d 100644 (file)
--- a/main.c
+++ b/main.c
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "sigrok-cli.h"
 #include "config.h"
 #include <glib.h>
-#include <libsigrok/libsigrok.h>
-#ifdef HAVE_SRD
-#include <libsigrokdecode/libsigrokdecode.h> /* First, so we avoid a _POSIX_C_SOURCE warning. */
-#endif
-#include "sigrok-cli.h"
 
 struct sr_context *sr_ctx = NULL;
 #ifdef HAVE_SRD
index 059d33930d6ce373147dce663e8df91171cdb850..f587f8d0e9da6701083a16283de0992e64b51c8f 100644 (file)
--- a/parsers.c
+++ b/parsers.c
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "sigrok-cli.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <string.h>
 #include <glib.h>
-#include <libsigrok/libsigrok.h>
-#include "sigrok-cli.h"
 
 static struct sr_probe *find_probe(GSList *probelist, const char *probename)
 {
index 12033dcc8316a9b8f362d3c751ea3745b883f513..130eed5a751cb9fe16f1e4f0d737fbec829fef2c 100644 (file)
--- a/session.c
+++ b/session.c
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "sigrok-cli.h"
 #include "config.h"
 #include <glib.h>
 #include <glib/gstdio.h>
-#include <libsigrok/libsigrok.h>
-#ifdef HAVE_SRD
-#include <libsigrokdecode/libsigrokdecode.h> /* First, so we avoid a _POSIX_C_SOURCE warning. */
-#endif
-#include "sigrok-cli.h"
 
 static struct sr_output_format *output_format = NULL;
 static int default_output_format = FALSE;
diff --git a/show.c b/show.c
index 07341c9c6c6adc753abae27e1341d24bd2226210..db643d13304a88ed0e61f5eae21610b6b7e6bc27 100644 (file)
--- a/show.c
+++ b/show.c
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "sigrok-cli.h"
 #include "config.h"
 #include <glib.h>
-#include <libsigrok/libsigrok.h>
-#ifdef HAVE_SRD
-#include <libsigrokdecode/libsigrokdecode.h>
-#endif
-#include "sigrok-cli.h"
 
 extern gint opt_loglevel;
 extern gchar *opt_pds;
index 74e4fdaa36dbc97fcac327abd8c9d31e5646b682..27ae8762663ce879122bf4567cae0f6f8a1b100a 100644 (file)
 #define SIGROK_CLI_SIGROK_CLI_H
 
 #include "config.h"
-#include <libsigrok/libsigrok.h>
 #ifdef HAVE_SRD
+/* First, so we avoid a _POSIX_C_SOURCE warning. */
 #include <libsigrokdecode/libsigrokdecode.h>
 #endif
+#include <libsigrok/libsigrok.h>
 
 #define DEFAULT_OUTPUT_FORMAT "bits:width=64"