diff --git a/Android.mk b/Android.mk
index 58885ad51265518aa00ea25ff02ed1343d81ceab..245bd7808dc6b07a0050c36f79dd67de4ba15554 100644
--- a/Android.mk
+++ b/Android.mk
@@ -24,6 +24,7 @@ LOCAL_CPP_EXTENSION := .cc
 
 LOCAL_C_INCLUDES := $(LOCAL_PATH) external/e2fsprogs/lib
 LOCAL_SRC_FILES := $(sgdisk_src_files)
+LOCAL_CFLAGS += -Wno-unused-parameter -Werror
 
 LOCAL_SHARED_LIBRARIES := libext2_uuid
 
@@ -41,6 +42,7 @@ endif
 
 LOCAL_C_INCLUDES := $(LOCAL_PATH) external/e2fsprogs/lib
 LOCAL_SRC_FILES := $(sgdisk_src_files)
+LOCAL_CFLAGS += -Wno-unused-parameter -Werror
 
 LOCAL_SHARED_LIBRARIES := libext2_uuid-host
 
diff --git a/attributes.cc b/attributes.cc
index f3cd58527b36e38d04646c4da3293aa334bea3a5..bbd5aad86e5d499441a50acf4a68a4e5df478581 100644
--- a/attributes.cc
+++ b/attributes.cc
@@ -7,7 +7,9 @@
   under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
 
 #define __STDC_LIMIT_MACROS
+#ifndef __STDC_CONSTANT_MACROS
 #define __STDC_CONSTANT_MACROS
+#endif
 
 #include <stdint.h>
 #include <stdio.h>
diff --git a/basicmbr.cc b/basicmbr.cc
index 566148702f1addc1b1548b3572f084341da2cc4a..c3c065321f964c070432bdfba40fe7d3ca21b582 100644
--- a/basicmbr.cc
+++ b/basicmbr.cc
@@ -7,7 +7,9 @@
   under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
 
 #define __STDC_LIMIT_MACROS
+#ifndef __STDC_CONSTANT_MACROS
 #define __STDC_CONSTANT_MACROS
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/bsd.cc b/bsd.cc
index f487f18e82d19cb36b29b0274c6af882c3dc9d12..59557c2e37e574925379aaaf4cbc7a5aaa4b33a7 100644
--- a/bsd.cc
+++ b/bsd.cc
@@ -7,7 +7,9 @@
   under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
 
 #define __STDC_LIMIT_MACROS
+#ifndef __STDC_CONSTANT_MACROS
 #define __STDC_CONSTANT_MACROS
+#endif
 
 #include <stdio.h>
 //#include <unistd.h>
diff --git a/crc32.cc b/crc32.cc
index d253dd936aa5ae35387e3f54c09d4b3d44c0022e..5eca100e046ef997c50f592af897edfae3a2c08e 100644
--- a/crc32.cc
+++ b/crc32.cc
@@ -31,7 +31,7 @@ uint32_t crc_tab[256];
  */
 uint32_t chksum_crc32 (unsigned char *block, unsigned int length)
 {
-   register unsigned long crc;
+   unsigned long crc;
    unsigned long i;
 
    crc = 0xFFFFFFFF;
diff --git a/diskio-unix.cc b/diskio-unix.cc
index af71cdb8418d78d1b8e7e28258d080ebd8cf5204..75fad2e01e75ae1ee4bbdc093394499137c63a03 100644
--- a/diskio-unix.cc
+++ b/diskio-unix.cc
@@ -13,7 +13,9 @@
 // under the terms of the GNU GPL version 2, as detailed in the COPYING file.
 
 #define __STDC_LIMIT_MACROS
+#ifndef __STDC_CONSTANT_MACROS
 #define __STDC_CONSTANT_MACROS
+#endif
 
 #include <sys/ioctl.h>
 #include <string.h>
diff --git a/diskio.cc b/diskio.cc
index baf235b9009d5d6778ff997f9833185162428ef3..f65011dab075352da181698f8520368d5178227f 100644
--- a/diskio.cc
+++ b/diskio.cc
@@ -13,7 +13,9 @@
 // under the terms of the GNU GPL version 2, as detailed in the COPYING file.
 
 #define __STDC_LIMIT_MACROS
+#ifndef __STDC_CONSTANT_MACROS
 #define __STDC_CONSTANT_MACROS
+#endif
 
 #ifdef _WIN32
 #include <windows.h>
diff --git a/gpt.cc b/gpt.cc
index d0a46c69506b1b12e75a2b0537cdc03fd3a9fbba..038e4f3a4a8053555c6dd94ab227aafcb454f0eb 100644
--- a/gpt.cc
+++ b/gpt.cc
@@ -7,7 +7,9 @@
   under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
 
 #define __STDC_LIMIT_MACROS
+#ifndef __STDC_CONSTANT_MACROS
 #define __STDC_CONSTANT_MACROS
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/gptcl.cc b/gptcl.cc
index 7c1d5cf35e146ca4af3347043d2943d09b42f0ab..bdb46932dd29c892f90649ea27378b476978fc10 100644
--- a/gptcl.cc
+++ b/gptcl.cc
@@ -109,7 +109,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
       {"version", 'V', POPT_ARG_NONE, NULL, 'V', "display version information", ""},
       {"zap", 'z', POPT_ARG_NONE, NULL, 'z', "zap (destroy) GPT (but not MBR) data structures", ""},
       {"zap-all", 'Z', POPT_ARG_NONE, NULL, 'Z', "zap (destroy) GPT and MBR data structures", ""},
-      POPT_AUTOHELP { NULL, 0, 0, NULL, 0 }
+      POPT_AUTOHELP { NULL, 0, 0, NULL, 0, NULL, NULL }
    };
 
    // Create popt context...
diff --git a/gptpart.cc b/gptpart.cc
index 17d6f15c61b6c3f6ee68faf2bc230d98f761c0a9..7e899092a36931bd9f66ab6d1f9e1a9dfe0ddfc6 100644
--- a/gptpart.cc
+++ b/gptpart.cc
@@ -13,7 +13,9 @@
 // under the terms of the GNU GPL version 2, as detailed in the COPYING file.
 
 #define __STDC_LIMIT_MACROS
+#ifndef __STDC_CONSTANT_MACROS
 #define __STDC_CONSTANT_MACROS
+#endif
 
 #ifdef USE_UTF16
 #include <unicode/ustdio.h>
diff --git a/guid.cc b/guid.cc
index 1e73ab77d854d5d49e3cf069f60df52c726b3b2c..e3e495cbeb7069e58ae36c94ae1b725e9478142c 100644
--- a/guid.cc
+++ b/guid.cc
@@ -12,7 +12,9 @@
 //
 
 #define __STDC_LIMIT_MACROS
+#ifndef __STDC_CONSTANT_MACROS
 #define __STDC_CONSTANT_MACROS
+#endif
 
 #include <stdio.h>
 #include <time.h>
diff --git a/mbr.cc b/mbr.cc
index 08c61be6421492851c2418e70d5f85f29766a7b2..d317f522e06a3aa33c178c03df06136d97626e9a 100644
--- a/mbr.cc
+++ b/mbr.cc
@@ -7,7 +7,9 @@
   under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
 
 #define __STDC_LIMIT_MACROS
+#ifndef __STDC_CONSTANT_MACROS
 #define __STDC_CONSTANT_MACROS
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/mbrpart.cc b/mbrpart.cc
index 0ca5814ddca6a23fce485bfb4a3d56f64645019e..c805d751a75d75b3c775ad34d76f31ee2a20e5df 100644
--- a/mbrpart.cc
+++ b/mbrpart.cc
@@ -18,7 +18,9 @@
 */
 
 #define __STDC_LIMIT_MACROS
+#ifndef __STDC_CONSTANT_MACROS
 #define __STDC_CONSTANT_MACROS
+#endif
 
 #include <stddef.h>
 #include <stdint.h>
diff --git a/parttypes.cc b/parttypes.cc
index 175aca5c74c07aa516b8df424df7168621301488..47c0f726baaa25f5743cce53e2826a58d3ad850d 100644
--- a/parttypes.cc
+++ b/parttypes.cc
@@ -6,7 +6,9 @@
   under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
 
 #define __STDC_LIMIT_MACROS
+#ifndef __STDC_CONSTANT_MACROS
 #define __STDC_CONSTANT_MACROS
+#endif
 
 #include <string.h>
 #include <stdint.h>
diff --git a/support.cc b/support.cc
index 0ff34851861569e1711fe2520850c4d5879deb5a..a7242f68df155eb5c0f435196d21a84dbfbb0aef 100644
--- a/support.cc
+++ b/support.cc
@@ -7,7 +7,9 @@
   under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
 
 #define __STDC_LIMIT_MACROS
+#ifndef __STDC_CONSTANT_MACROS
 #define __STDC_CONSTANT_MACROS
+#endif
 
 #include <stdio.h>
 #include <stdint.h>