Browse Source

firmware: Fix strcmp() build on gcc-9.2.0
Thanks to Uffe Jakobsen!

Keir Fraser 5 years ago
parent
commit
07746e10e3
3 changed files with 2 additions and 4 deletions
  1. 1 0
      inc/decls.h
  2. 0 3
      inc/util.h
  3. 1 1
      src/util.c

+ 1 - 0
inc/decls.h

@@ -13,6 +13,7 @@
 #include <stdint.h>
 #include <stdarg.h>
 #include <stddef.h>
+#include <limits.h>
 
 #include "util.h"
 #include "stm32f10x_regs.h"

+ 0 - 3
inc/util.h

@@ -19,9 +19,6 @@ typedef char bool_t;
 #define TRUE 1
 #define FALSE 0
 
-#define LONG_MAX ((long int)((~0UL)>>1))
-#define LONG_MIN ((long int)~LONG_MAX)
-
 #ifndef offsetof
 #define offsetof(a,b) __builtin_offsetof(a,b)
 #endif

+ 1 - 1
src/util.c

@@ -119,7 +119,7 @@ size_t strnlen(const char *s, size_t maxlen)
 
 int strcmp(const char *s1, const char *s2)
 {
-    return strncmp(s1, s2, ~0);
+    return strncmp(s1, s2, INT_MAX);
 }
 
 int strncmp(const char *s1, const char *s2, size_t n)