Skip to content

Commit

Permalink
Fix a bunch of compiler warnings.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
uwehermann committed Nov 19, 2013
1 parent 3036488 commit 20fb52e
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 29 deletions.
3 changes: 1 addition & 2 deletions anykey.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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;
Expand Down
6 changes: 1 addition & 5 deletions decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@
* 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;
Expand Down
3 changes: 1 addition & 2 deletions device.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
* 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;
Expand Down
3 changes: 1 addition & 2 deletions input.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
* 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;
Expand Down
6 changes: 1 addition & 5 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@
* 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
Expand Down
3 changes: 1 addition & 2 deletions parsers.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
* 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)
{
Expand Down
6 changes: 1 addition & 5 deletions session.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@
* 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;
Expand Down
6 changes: 1 addition & 5 deletions show.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@
* 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;
Expand Down
3 changes: 2 additions & 1 deletion sigrok-cli.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
#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"

Expand Down

0 comments on commit 20fb52e

Please sign in to comment.