[Git][NTPsec/ntpsec][master] 4 commits: waf: Fix test for -Wsuggest-attribute=const, for debug only.

Gary E. Miller gitlab at mg.gitlab.com
Fri Apr 14 21:40:50 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
9f1ce2d6 by Gary E. Miller at 2017-04-14T14:24:16-07:00
waf: Fix test for -Wsuggest-attribute=const, for debug only.

- - - - -
53a6a0a5 by Gary E. Miller at 2017-04-14T14:35:12-07:00
clk_rawdcf: add an attribute(pure)

- - - - -
5f938d81 by Gary E. Miller at 2017-04-14T14:35:43-07:00
mbg_gps166: add an attribute(pure)

- - - - -
b147d486 by Gary E. Miller at 2017-04-14T14:38:52-07:00
trimble_convert(): add attribute((pure))

- - - - -


4 changed files:

- include/mbg_gps166.h
- include/trimble.h
- libparse/clk_rawdcf.c
- wafhelpers/configure.py


Changes:

=====================================
include/mbg_gps166.h
=====================================
--- a/include/mbg_gps166.h
+++ b/include/mbg_gps166.h
@@ -944,7 +944,7 @@ void get_mbg_eph (unsigned char **, EPH *);
 void get_mbg_alm (unsigned char **, ALM *);
 void get_mbg_iono (unsigned char **, IONO *);
 
-CSUM mbg_csum (unsigned char *, unsigned int);
+CSUM mbg_csum (unsigned char *, unsigned int) __attribute__((pure));
 
 #endif
 /*


=====================================
include/trimble.h
=====================================
--- a/include/trimble.h
+++ b/include/trimble.h
@@ -105,7 +105,8 @@ typedef struct cmd_info
 extern cmd_info_t trimble_rcmds[];
 extern cmd_info_t trimble_scmds[];
 
-extern cmd_info_t *trimble_convert (unsigned int cmd, cmd_info_t *tbl);
+extern cmd_info_t *trimble_convert (unsigned int cmd, cmd_info_t *tbl)
+			__attribute__((pure));
 
 #endif
 /*


=====================================
libparse/clk_rawdcf.c
=====================================
--- a/libparse/clk_rawdcf.c
+++ b/libparse/clk_rawdcf.c
@@ -142,6 +142,9 @@ static struct partab
 #define DCF_Z_MET 0x2
 #define DCF_Z_MED 0x1
 
+static long ext_bf(unsigned char *, int, const unsigned char *)
+	__attribute__((pure));
+
 static long
 ext_bf(
 	unsigned char *buf,


=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -302,7 +302,6 @@ def cmd_configure(ctx, config):
         # turn on some annoying warnings
         ctx.env.CFLAGS = [
             # "-Wall",                # for masochists
-            #"-Wsuggest-attribute=const", # fails build
             #"-Waggregate-return",    # breaks ldiv(), ntpcal_daysplit(),  etc.
             "-Wbad-function-cast",
             "-Wfloat-equal",          # Not Ready For Prime Time
@@ -315,8 +314,11 @@ def cmd_configure(ctx, config):
         ] + ctx.env.CFLAGS
         cc_test_flags += [
             # fails on Solaris and OpenBSD 6
+            # complains about a Bison bug
             ('w_sign_conversion', "-Wsign-conversion"),
             # fails on clang
+            ('w_suggest_attribute_const', "-Wsuggest-attribute=const"),
+            # fails on clang
             ('w_suggest_attribute_noreturn', "-Wsuggest-attribute=noreturn"),
             # fails on clang
             ('w_suggest_attribute_pure', "-Wsuggest-attribute=pure"),
@@ -333,10 +335,13 @@ def cmd_configure(ctx, config):
         "-Wunused",
         ] + ctx.env.CFLAGS
 
+    # gotta be tricky to test for -Wsuggest-attribute=const
     FRAGMENT = '''
+int tmp;
 int main(int argc, char **argv) {
         (void)argc; (void)argv;
-        return 0;
+        tmp = argc;
+        return argc;
 }
 '''
 
@@ -381,6 +386,8 @@ int main(int argc, char **argv) {
         ctx.env.CFLAGS = ["-flto"] + ctx.env.CFLAGS
 
     # debug warnings that are not available with all compilers
+    if ctx.env.HAS_w_suggest_attribute_const:
+        ctx.env.CFLAGS = ['-Wsuggest-attribute=const'] + ctx.env.CFLAGS
     if ctx.env.HAS_w_suggest_attribute_noreturn:
         ctx.env.CFLAGS = ['-Wsuggest-attribute=noreturn'] + ctx.env.CFLAGS
     if ctx.env.HAS_w_suggest_attribute_pure:



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/772957ca2403c98109de810fd39f0987afd7397f...b147d4869e175fe9e15c6467303840a7f21bfc5e

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/772957ca2403c98109de810fd39f0987afd7397f...b147d4869e175fe9e15c6467303840a7f21bfc5e
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170414/92611149/attachment.html>


More information about the vc mailing list