diff mbox series

[libubootenv] CMakeLists: fix build with old compilers

Message ID 1568647450-21217-1-git-send-email-pjtexier@koncepto.io
State Accepted
Headers show
Series [libubootenv] CMakeLists: fix build with old compilers | expand

Commit Message

'Darko Komljenovic' via swupdate Sept. 16, 2019, 3:24 p.m. UTC
The libubootenv code uses some C99 constructs, but old compilers such
as gcc 4.7 don't default to -std=c99. This commit makes sure libubootenv
is built with -std=gnu99.

Fixes:

src/uboot_env.c:897:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
     for (int i = 0; i < strlen(pval); i++) {
     ^

Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io>
---
 CMakeLists.txt | 2 ++
 1 file changed, 2 insertions(+)

Comments

Stefano Babic Oct. 14, 2019, 7:38 p.m. UTC | #1
On 14/10/19 21:22, Pierre-Jean Texier wrote:
> Hi Stefano,
> 
> Le 16/09/2019 à 17:24, 'Pierre-Jean Texier' via swupdate a écrit :
>> The libubootenv code uses some C99 constructs, but old compilers such
>> as gcc 4.7 don't default to -std=c99. This commit makes sure libubootenv
>> is built with -std=gnu99.
>>
>> Fixes:
>>
>> src/uboot_env.c:897:5: error: ‘for’ loop initial declarations are only
>> allowed in C99 or C11 mode
>>       for (int i = 0; i < strlen(pval); i++) {
>>       ^
>>
>> Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io>
>> ---
>>   CMakeLists.txt | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/CMakeLists.txt b/CMakeLists.txt
>> index 118fc32..e7bde49 100644
>> --- a/CMakeLists.txt
>> +++ b/CMakeLists.txt
>> @@ -8,6 +8,8 @@ set(VERSION    "0.1")
>>   SET(SOVERSION "${VERSION}")
>>   add_definitions(-DVERSION="${VERSION}")
>>   +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
>> +
>>   #set(CMAKE_C_FLAGS_DEBUG "-g")
>>   include_directories ("${PROJECT_SOURCE_DIR}/src")
>>   add_subdirectory (src)
>>
> 
> Gentle ping :)

Applied to -master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 118fc32..e7bde49 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,6 +8,8 @@  set(VERSION	"0.1")
 SET(SOVERSION "${VERSION}")
 add_definitions(-DVERSION="${VERSION}")
 
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
+
 #set(CMAKE_C_FLAGS_DEBUG "-g")
 include_directories ("${PROJECT_SOURCE_DIR}/src")
 add_subdirectory (src)