Fossil SCM
Fix the C89-style related declarations; add a gcc warning to flag such issues, in case these slip through again
Commit
da9f362015a3f7766f9dca2259cd8043cdcea9f37c9b2abc5a0d4d1ada2b18ba
Parent
8f4fd8c1d8b2757…
5 files changed
+8
+1
-1
+5
-4
+3
-2
+2
-1
M
auto.def
+8
| --- auto.def | ||
| +++ auto.def | ||
| @@ -101,10 +101,18 @@ | ||
| 101 | 101 | define USE_SYSTEM_SQLITE 0 |
| 102 | 102 | define USE_LINENOISE 0 |
| 103 | 103 | define FOSSIL_ENABLE_MINIZ 0 |
| 104 | 104 | define USE_MMAN_H 0 |
| 105 | 105 | define USE_SEE 0 |
| 106 | + | |
| 107 | + | |
| 108 | +# Maintain the C89/C90-style order of variable declarations before statements. | |
| 109 | +# Check if the compiler supports the respective warning flag. | |
| 110 | +if {[cctest -cflags -Wdeclaration-after-statement]} { | |
| 111 | + define-append EXTRA_CFLAGS -Wdeclaration-after-statement | |
| 112 | +} | |
| 113 | + | |
| 106 | 114 | |
| 107 | 115 | # This procedure is a customized version of "cc-check-function-in-lib", |
| 108 | 116 | # that does not modify the LIBS variable. Its use prevents prematurely |
| 109 | 117 | # pulling in libraries that will be added later anyhow (e.g. "-ldl"). |
| 110 | 118 | proc check-function-in-lib {function libs {otherlibs {}}} { |
| 111 | 119 |
| --- auto.def | |
| +++ auto.def | |
| @@ -101,10 +101,18 @@ | |
| 101 | define USE_SYSTEM_SQLITE 0 |
| 102 | define USE_LINENOISE 0 |
| 103 | define FOSSIL_ENABLE_MINIZ 0 |
| 104 | define USE_MMAN_H 0 |
| 105 | define USE_SEE 0 |
| 106 | |
| 107 | # This procedure is a customized version of "cc-check-function-in-lib", |
| 108 | # that does not modify the LIBS variable. Its use prevents prematurely |
| 109 | # pulling in libraries that will be added later anyhow (e.g. "-ldl"). |
| 110 | proc check-function-in-lib {function libs {otherlibs {}}} { |
| 111 |
| --- auto.def | |
| +++ auto.def | |
| @@ -101,10 +101,18 @@ | |
| 101 | define USE_SYSTEM_SQLITE 0 |
| 102 | define USE_LINENOISE 0 |
| 103 | define FOSSIL_ENABLE_MINIZ 0 |
| 104 | define USE_MMAN_H 0 |
| 105 | define USE_SEE 0 |
| 106 | |
| 107 | |
| 108 | # Maintain the C89/C90-style order of variable declarations before statements. |
| 109 | # Check if the compiler supports the respective warning flag. |
| 110 | if {[cctest -cflags -Wdeclaration-after-statement]} { |
| 111 | define-append EXTRA_CFLAGS -Wdeclaration-after-statement |
| 112 | } |
| 113 | |
| 114 | |
| 115 | # This procedure is a customized version of "cc-check-function-in-lib", |
| 116 | # that does not modify the LIBS variable. Its use prevents prematurely |
| 117 | # pulling in libraries that will be added later anyhow (e.g. "-ldl"). |
| 118 | proc check-function-in-lib {function libs {otherlibs {}}} { |
| 119 |
+1
-1
| --- src/add.c | ||
| +++ src/add.c | ||
| @@ -482,14 +482,14 @@ | ||
| 482 | 482 | ** _silently_ skips over any names for which |
| 483 | 483 | ** file_is_reserved_name() returns true or which is in the |
| 484 | 484 | ** fossil_reserved_name() list. We do not need to warn for those, |
| 485 | 485 | ** as they're outright verboten. */ |
| 486 | 486 | if(db_exists("SELECT 1 FROM sfile WHERE win_reserved(pathname)")){ |
| 487 | + int reservedCount = 0; | |
| 487 | 488 | Stmt q = empty_Stmt; |
| 488 | 489 | db_prepare(&q,"SELECT pathname FROM sfile " |
| 489 | 490 | "WHERE win_reserved(pathname)"); |
| 490 | - int reservedCount = 0; | |
| 491 | 491 | while( db_step(&q)==SQLITE_ROW ){ |
| 492 | 492 | const char * zName = db_column_text(&q, 0); |
| 493 | 493 | ++reservedCount; |
| 494 | 494 | if(allowReservedFlag){ |
| 495 | 495 | fossil_warning("WARNING: Windows-reserved " |
| 496 | 496 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -482,14 +482,14 @@ | |
| 482 | ** _silently_ skips over any names for which |
| 483 | ** file_is_reserved_name() returns true or which is in the |
| 484 | ** fossil_reserved_name() list. We do not need to warn for those, |
| 485 | ** as they're outright verboten. */ |
| 486 | if(db_exists("SELECT 1 FROM sfile WHERE win_reserved(pathname)")){ |
| 487 | Stmt q = empty_Stmt; |
| 488 | db_prepare(&q,"SELECT pathname FROM sfile " |
| 489 | "WHERE win_reserved(pathname)"); |
| 490 | int reservedCount = 0; |
| 491 | while( db_step(&q)==SQLITE_ROW ){ |
| 492 | const char * zName = db_column_text(&q, 0); |
| 493 | ++reservedCount; |
| 494 | if(allowReservedFlag){ |
| 495 | fossil_warning("WARNING: Windows-reserved " |
| 496 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -482,14 +482,14 @@ | |
| 482 | ** _silently_ skips over any names for which |
| 483 | ** file_is_reserved_name() returns true or which is in the |
| 484 | ** fossil_reserved_name() list. We do not need to warn for those, |
| 485 | ** as they're outright verboten. */ |
| 486 | if(db_exists("SELECT 1 FROM sfile WHERE win_reserved(pathname)")){ |
| 487 | int reservedCount = 0; |
| 488 | Stmt q = empty_Stmt; |
| 489 | db_prepare(&q,"SELECT pathname FROM sfile " |
| 490 | "WHERE win_reserved(pathname)"); |
| 491 | while( db_step(&q)==SQLITE_ROW ){ |
| 492 | const char * zName = db_column_text(&q, 0); |
| 493 | ++reservedCount; |
| 494 | if(allowReservedFlag){ |
| 495 | fossil_warning("WARNING: Windows-reserved " |
| 496 |
+5
-4
| --- src/finfo.c | ||
| +++ src/finfo.c | ||
| @@ -141,21 +141,22 @@ | ||
| 141 | 141 | blob_write_to_file(&record, "-"); |
| 142 | 142 | blob_reset(&record); |
| 143 | 143 | blob_reset(&fname); |
| 144 | 144 | }else if( find_option("id","i",0) ){ |
| 145 | 145 | Blob fname; |
| 146 | + int rid; | |
| 146 | 147 | const char *zRevision = find_option("revision", "r", 1); |
| 147 | 148 | |
| 148 | 149 | verify_all_options(); |
| 149 | 150 | |
| 150 | 151 | if( zRevision==0 ) usage("-i|--id also requires -r|--revision"); |
| 151 | 152 | if( g.argc!=3 ) usage("-r|--revision REVISION FILENAME"); |
| 152 | 153 | file_tree_name(g.argv[2], &fname, 0, 1); |
| 153 | - int rid = db_int(0, "SELECT rid FROM blob WHERE uuid =" | |
| 154 | - " (SELECT uuid FROM files_of_checkin(%Q)" | |
| 155 | - " WHERE filename=%B %s)", | |
| 156 | - zRevision, &fname, filename_collation()); | |
| 154 | + rid = db_int(0, "SELECT rid FROM blob WHERE uuid =" | |
| 155 | + " (SELECT uuid FROM files_of_checkin(%Q)" | |
| 156 | + " WHERE filename=%B %s)", | |
| 157 | + zRevision, &fname, filename_collation()); | |
| 157 | 158 | if( rid==0 ) { |
| 158 | 159 | fossil_fatal("file not found for revision %s: %s", |
| 159 | 160 | zRevision, blob_str(&fname)); |
| 160 | 161 | } |
| 161 | 162 | whatis_rid(rid,0); |
| 162 | 163 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -141,21 +141,22 @@ | |
| 141 | blob_write_to_file(&record, "-"); |
| 142 | blob_reset(&record); |
| 143 | blob_reset(&fname); |
| 144 | }else if( find_option("id","i",0) ){ |
| 145 | Blob fname; |
| 146 | const char *zRevision = find_option("revision", "r", 1); |
| 147 | |
| 148 | verify_all_options(); |
| 149 | |
| 150 | if( zRevision==0 ) usage("-i|--id also requires -r|--revision"); |
| 151 | if( g.argc!=3 ) usage("-r|--revision REVISION FILENAME"); |
| 152 | file_tree_name(g.argv[2], &fname, 0, 1); |
| 153 | int rid = db_int(0, "SELECT rid FROM blob WHERE uuid =" |
| 154 | " (SELECT uuid FROM files_of_checkin(%Q)" |
| 155 | " WHERE filename=%B %s)", |
| 156 | zRevision, &fname, filename_collation()); |
| 157 | if( rid==0 ) { |
| 158 | fossil_fatal("file not found for revision %s: %s", |
| 159 | zRevision, blob_str(&fname)); |
| 160 | } |
| 161 | whatis_rid(rid,0); |
| 162 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -141,21 +141,22 @@ | |
| 141 | blob_write_to_file(&record, "-"); |
| 142 | blob_reset(&record); |
| 143 | blob_reset(&fname); |
| 144 | }else if( find_option("id","i",0) ){ |
| 145 | Blob fname; |
| 146 | int rid; |
| 147 | const char *zRevision = find_option("revision", "r", 1); |
| 148 | |
| 149 | verify_all_options(); |
| 150 | |
| 151 | if( zRevision==0 ) usage("-i|--id also requires -r|--revision"); |
| 152 | if( g.argc!=3 ) usage("-r|--revision REVISION FILENAME"); |
| 153 | file_tree_name(g.argv[2], &fname, 0, 1); |
| 154 | rid = db_int(0, "SELECT rid FROM blob WHERE uuid =" |
| 155 | " (SELECT uuid FROM files_of_checkin(%Q)" |
| 156 | " WHERE filename=%B %s)", |
| 157 | zRevision, &fname, filename_collation()); |
| 158 | if( rid==0 ) { |
| 159 | fossil_fatal("file not found for revision %s: %s", |
| 160 | zRevision, blob_str(&fname)); |
| 161 | } |
| 162 | whatis_rid(rid,0); |
| 163 |
+3
-2
| --- src/linenoise.c | ||
| +++ src/linenoise.c | ||
| @@ -1028,21 +1028,22 @@ | ||
| 1028 | 1028 | static char *linenoiseNoTTY(void) { |
| 1029 | 1029 | char *line = NULL; |
| 1030 | 1030 | size_t len = 0, maxlen = 0; |
| 1031 | 1031 | |
| 1032 | 1032 | while(1) { |
| 1033 | + int c; | |
| 1033 | 1034 | if (len == maxlen) { |
| 1035 | + char *oldval = line; | |
| 1034 | 1036 | if (maxlen == 0) maxlen = 16; |
| 1035 | 1037 | maxlen *= 2; |
| 1036 | - char *oldval = line; | |
| 1037 | 1038 | line = realloc(line,maxlen); |
| 1038 | 1039 | if (line == NULL) { |
| 1039 | 1040 | if (oldval) free(oldval); |
| 1040 | 1041 | return NULL; |
| 1041 | 1042 | } |
| 1042 | 1043 | } |
| 1043 | - int c = fgetc(stdin); | |
| 1044 | + c = fgetc(stdin); | |
| 1044 | 1045 | if (c == EOF || c == '\n') { |
| 1045 | 1046 | if (c == EOF && len == 0) { |
| 1046 | 1047 | free(line); |
| 1047 | 1048 | return NULL; |
| 1048 | 1049 | } else { |
| 1049 | 1050 |
| --- src/linenoise.c | |
| +++ src/linenoise.c | |
| @@ -1028,21 +1028,22 @@ | |
| 1028 | static char *linenoiseNoTTY(void) { |
| 1029 | char *line = NULL; |
| 1030 | size_t len = 0, maxlen = 0; |
| 1031 | |
| 1032 | while(1) { |
| 1033 | if (len == maxlen) { |
| 1034 | if (maxlen == 0) maxlen = 16; |
| 1035 | maxlen *= 2; |
| 1036 | char *oldval = line; |
| 1037 | line = realloc(line,maxlen); |
| 1038 | if (line == NULL) { |
| 1039 | if (oldval) free(oldval); |
| 1040 | return NULL; |
| 1041 | } |
| 1042 | } |
| 1043 | int c = fgetc(stdin); |
| 1044 | if (c == EOF || c == '\n') { |
| 1045 | if (c == EOF && len == 0) { |
| 1046 | free(line); |
| 1047 | return NULL; |
| 1048 | } else { |
| 1049 |
| --- src/linenoise.c | |
| +++ src/linenoise.c | |
| @@ -1028,21 +1028,22 @@ | |
| 1028 | static char *linenoiseNoTTY(void) { |
| 1029 | char *line = NULL; |
| 1030 | size_t len = 0, maxlen = 0; |
| 1031 | |
| 1032 | while(1) { |
| 1033 | int c; |
| 1034 | if (len == maxlen) { |
| 1035 | char *oldval = line; |
| 1036 | if (maxlen == 0) maxlen = 16; |
| 1037 | maxlen *= 2; |
| 1038 | line = realloc(line,maxlen); |
| 1039 | if (line == NULL) { |
| 1040 | if (oldval) free(oldval); |
| 1041 | return NULL; |
| 1042 | } |
| 1043 | } |
| 1044 | c = fgetc(stdin); |
| 1045 | if (c == EOF || c == '\n') { |
| 1046 | if (c == EOF && len == 0) { |
| 1047 | free(line); |
| 1048 | return NULL; |
| 1049 | } else { |
| 1050 |
+2
-1
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -1588,10 +1588,11 @@ | ||
| 1588 | 1588 | void whistory_page(void){ |
| 1589 | 1589 | Stmt q; |
| 1590 | 1590 | const char *zPageName; |
| 1591 | 1591 | double rNow; |
| 1592 | 1592 | int showRid; |
| 1593 | + char zAuthor[64]; | |
| 1593 | 1594 | login_check_credentials(); |
| 1594 | 1595 | if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; } |
| 1595 | 1596 | zPageName = PD("name",""); |
| 1596 | 1597 | style_set_current_feature("wiki"); |
| 1597 | 1598 | style_header("History Of %s", zPageName); |
| @@ -1629,11 +1630,11 @@ | ||
| 1629 | 1630 | @ <th>RID</th> |
| 1630 | 1631 | } |
| 1631 | 1632 | @ <th> </th> |
| 1632 | 1633 | @ </tr></thead><tbody> |
| 1633 | 1634 | rNow = db_double(0.0, "SELECT julianday('now')"); |
| 1634 | - char zAuthor[64]; memset( zAuthor, 0, sizeof(zAuthor) ); | |
| 1635 | + memset( zAuthor, 0, sizeof(zAuthor) ); | |
| 1635 | 1636 | while( db_step(&q)==SQLITE_ROW ){ |
| 1636 | 1637 | double rMtime = db_column_double(&q, 0); |
| 1637 | 1638 | const char *zUuid = db_column_text(&q, 1); |
| 1638 | 1639 | const char *zUser = db_column_text(&q, 2); |
| 1639 | 1640 | int wrid = db_column_int(&q, 3); |
| 1640 | 1641 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -1588,10 +1588,11 @@ | |
| 1588 | void whistory_page(void){ |
| 1589 | Stmt q; |
| 1590 | const char *zPageName; |
| 1591 | double rNow; |
| 1592 | int showRid; |
| 1593 | login_check_credentials(); |
| 1594 | if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; } |
| 1595 | zPageName = PD("name",""); |
| 1596 | style_set_current_feature("wiki"); |
| 1597 | style_header("History Of %s", zPageName); |
| @@ -1629,11 +1630,11 @@ | |
| 1629 | @ <th>RID</th> |
| 1630 | } |
| 1631 | @ <th> </th> |
| 1632 | @ </tr></thead><tbody> |
| 1633 | rNow = db_double(0.0, "SELECT julianday('now')"); |
| 1634 | char zAuthor[64]; memset( zAuthor, 0, sizeof(zAuthor) ); |
| 1635 | while( db_step(&q)==SQLITE_ROW ){ |
| 1636 | double rMtime = db_column_double(&q, 0); |
| 1637 | const char *zUuid = db_column_text(&q, 1); |
| 1638 | const char *zUser = db_column_text(&q, 2); |
| 1639 | int wrid = db_column_int(&q, 3); |
| 1640 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -1588,10 +1588,11 @@ | |
| 1588 | void whistory_page(void){ |
| 1589 | Stmt q; |
| 1590 | const char *zPageName; |
| 1591 | double rNow; |
| 1592 | int showRid; |
| 1593 | char zAuthor[64]; |
| 1594 | login_check_credentials(); |
| 1595 | if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; } |
| 1596 | zPageName = PD("name",""); |
| 1597 | style_set_current_feature("wiki"); |
| 1598 | style_header("History Of %s", zPageName); |
| @@ -1629,11 +1630,11 @@ | |
| 1630 | @ <th>RID</th> |
| 1631 | } |
| 1632 | @ <th> </th> |
| 1633 | @ </tr></thead><tbody> |
| 1634 | rNow = db_double(0.0, "SELECT julianday('now')"); |
| 1635 | memset( zAuthor, 0, sizeof(zAuthor) ); |
| 1636 | while( db_step(&q)==SQLITE_ROW ){ |
| 1637 | double rMtime = db_column_double(&q, 0); |
| 1638 | const char *zUuid = db_column_text(&q, 1); |
| 1639 | const char *zUser = db_column_text(&q, 2); |
| 1640 | int wrid = db_column_int(&q, 3); |
| 1641 |