Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame^] | 1 | gcc options '-Wmaybe-uninitialized' and '-std=gnu11' are not recognized by gcc |
| 2 | whose version is lower than 4.6, such as on Ubuntu 12.04. Drop them for backward |
| 3 | compatible. |
| 4 | |
| 5 | Upstream-Status: Pending |
| 6 | |
| 7 | Signed-off-by: Kai Kang <kai.kang@windriver.com> |
| 8 | --- |
| 9 | diff --git a/Make.defaults b/Make.defaults |
| 10 | index cc2baa9..118ae56 100644 |
| 11 | --- a/Make.defaults |
| 12 | +++ b/Make.defaults |
| 13 | @@ -10,10 +10,9 @@ CFLAGS ?= -O2 -g |
| 14 | |
| 15 | ARCH = $(shell uname -m) |
| 16 | clang_cflags = |
| 17 | -gcc_cflags = -Wmaybe-uninitialized |
| 18 | cflags := $(CFLAGS) \ |
| 19 | -Werror -Wall -Wsign-compare -Wstrict-aliasing \ |
| 20 | - -std=gnu11 -fshort-wchar -fPIC \ |
| 21 | + -fshort-wchar -fPIC \ |
| 22 | -fvisibility=hidden \ |
| 23 | -D_GNU_SOURCE -I${TOPDIR}/src/include/efivar/ \ |
| 24 | $(if $(filter $(CC),clang),$(clang_cflags),) \ |
| 25 | diff --git a/src/guid.h b/src/guid.h |
| 26 | index 9542ee1..0817991 100644 |
| 27 | --- a/src/guid.h |
| 28 | +++ b/src/guid.h |
| 29 | @@ -31,7 +31,8 @@ static inline int |
| 30 | real_isspace(char c) |
| 31 | { |
| 32 | char spaces[] = " \f\n\r\t\v"; |
| 33 | - for (int i = 0; spaces[i] != '\0'; i++) |
| 34 | + int i; |
| 35 | + for (i = 0; spaces[i] != '\0'; i++) |
| 36 | if (c == spaces[i]) |
| 37 | return 1; |
| 38 | return 0; |
| 39 | @@ -59,7 +60,8 @@ check_sanity(const char *text, size_t len) |
| 40 | static inline int |
| 41 | check_segment_sanity(const char *text, size_t len) |
| 42 | { |
| 43 | - for(unsigned int i = 0; i < len; i++) { |
| 44 | + unsigned int i; |
| 45 | + for(i = 0; i < len; i++) { |
| 46 | if (text[i] >= '0' && text[i] <= '9') |
| 47 | continue; |
| 48 | /* "| 0x20" is tolower() without having to worry about |
| 49 | diff --git a/src/makeguids.c b/src/makeguids.c |
| 50 | index e9acf15..7e16cb2 100644 |
| 51 | --- a/src/makeguids.c |
| 52 | +++ b/src/makeguids.c |
| 53 | @@ -150,7 +150,8 @@ main(int argc, char *argv[]) |
| 54 | |
| 55 | fprintf(header, "#ifndef EFIVAR_GUIDS_H\n#define EFIVAR_GUIDS_H 1\n\n"); |
| 56 | |
| 57 | - for (unsigned int i = 0; i < line-1; i++) { |
| 58 | + unsigned int i, j; |
| 59 | + for (i = 0; i < line-1; i++) { |
| 60 | if (!strcmp(outbuf[i].symbol, "efi_guid_zero")) |
| 61 | fprintf(symout, "\t.globl %s\n" |
| 62 | "\t.data\n" |
| 63 | @@ -176,7 +177,7 @@ main(int argc, char *argv[]) |
| 64 | fprintf(symout, "efi_guid_empty:\n"); |
| 65 | |
| 66 | uint8_t *guid_data = (uint8_t *) &outbuf[i].guid; |
| 67 | - for (unsigned int j = 0; j < sizeof (efi_guid_t); j++) |
| 68 | + for (j = 0; j < sizeof (efi_guid_t); j++) |
| 69 | fprintf(symout,"\t.byte 0x%02x\n", guid_data[j]); |
| 70 | |
| 71 | fprintf(symout, "%s_end:\n", outbuf[i].symbol); |