Mike Maslenkin [mailto:mike.maslen...@gmail.com] wrote:

]Sent: Monday, October 26, 2015 04:52 PM
]To: Scott Duplichan <sc...@notabs.org>
]Cc: 'El-Haj-Mahmoud, Samer' <samer.el-haj-mahm...@hpe.com>; 'edk2-devel-01' 
<edk2-de...@ml01.01.org>; 'Andrew ]Fish' <af...@apple.com>
]Subject: Re: [edk2] [MdeModulePkg] RegularExpressionDxe does not compile with 
Xcode 6.3.2
]
]Scott, thank you for your explanation.
]
]I'm just curious why
]HAVE_STDARG_PROTOTYPES is explicitly defined at 
]RegularExpressionDxe/Oniguruma/regerror.c
]
]Looks like a kinda hackish kludge of someone who ported this library ;)

Comparing to an original does show #define in question is
part of the edk2 porting changes:
https://raw.githubusercontent.com/gbbr/rubex/master/onig/regerror.c

I think the immediate question is what work-around is possible. Turning
this warning off is the only quick solution, based on your comment about
'a number of similar issues for other library modules'. One idea is to
add this to all the gcc flags:

    -Wno-unprototyped-calls

I think that would work except for gcc 4.4 and 4.5. Unfortunately,
these older gcc reject unknown -Wno options, unlike newer gcc where
unknown -Wno options are silently ignored. So even though standard
gcc 4.6 and newer don't recognize -Wno-unprototyped-calls, they will
accept it. But gcc 4.4 and 4.5 will fail to build.

Just adding -Wno-unprototyped-calls to more recent gcc editions is
probably sufficient. The patch that adds -Wno-unprototyped-calls to
SUSE gcc releases was created in 2013, and a quick search suggests
it is not in use with older gcc editions such as 4.4 and 4.5. Adding
-Wno-unprototyped-calls for gcc 4.8 and newer is probably all that is
needed. I think it would allow all SUSE gcc releases to work, and not
affect the operation of non-SUSE gcc releases.

A longer term project for someone with free time is to add gcc flag
-Wstrict-prototypes and Microsoft flag /w44255. Then submit patches
to fix the resulting build failures.

Thanks,
Scott




]On Sat, 2015-10-24 at 22:18 -0500, Scott Duplichan wrote:
]> Mike Maslenkin [mailto:mike.maslen...@gmail.com] wrote:
]> 
]> ]Sent: Saturday, October 24, 2015 04:57 PM
]> ]To: El-Haj-Mahmoud, Samer <samer.el-haj-mahm...@hpe.com>
]> ]Cc: edk2-devel-01 <edk2-de...@ml01.01.org>; Andrew Fish <af...@apple.com>
]> ]Subject: Re: [edk2] [MdeModulePkg] RegularExpressionDxe does not compile 
with Xcode 6.3.2
]> ]
]> ]Sorry for the noise, but I can not pass warnings here:
]> ]
]> ]build -p MdeModulePkg/MdeModulePkg.dsc -t GCC48 -a X64:
]> ]
]> ]Build environment: Linux-3.16.7-24-desktop-x86_64-with-SuSE-13.2-x86_64
]> ]Build start time: 00:20:50, Oct.25 2015
]> ]
]> ]
]> ]Building ... 
/home/user/edk2/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.inf
 [X64]
]> 
]/home/user/edk2/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.c:
 In function ]]‘OnigurumaMatch’:
]> 
]/home/user/edk2/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.c:123:5:
 error: call to ]]function ‘onig_error_code_to_str’ without a real prototype 
[-Werror=unprototyped-calls]
]> ]     onig_error_code_to_str ((OnigUChar *)ErrorMessage, OnigResult,
]> ]&ErrorInfo);
]> ]     ^
]> ]In file included
]> ]from 
/home/user/edk2/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.h:19:0,
]> ]
]> ]from 
/home/user/edk2/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.c:17:
]> 
]/home/user/edk2/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/oniguruma.h:722:5:
 note: ]]‘onig_error_code_to_str’ was declared here
]> ] int onig_error_code_to_str PV_((OnigUChar* s, int err_code, ...));
]> ]     ^
]> 
]/home/user/edk2/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.c:147:7:
 error: call to ]function ]‘onig_error_code_to_str’ without a real prototype 
[-Werror=unprototyped-calls]
]> ]       onig_error_code_to_str ((OnigUChar *)ErrorMessage, OnigResult);
]> ]       ^
]> ]In file included
]> ]from 
/home/user/edk2/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.h:19:0,
]> ]
]> ]from 
/home/user/edk2/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.c:17:
]> 
]/home/user/edk2/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/oniguruma.h:722:5:
 note: ]]‘onig_error_code_to_str’ was declared here
]> ] int onig_error_code_to_str PV_((OnigUChar* s, int err_code, ...));
]> ]     ^
]> ]cc1: all warnings being treated as errors
]> ]make: ***
]> 
]][/home/user/edk2/Build/MdeModule/DEBUG_GCC48/X64/MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe]/]OUTPUT/RegularExpressionDxe.obj]
 Error 1
]> ]
]> ]and this is because of
]> ]
]> ]<<<< RegularExpressionDxe/Oniguruma/oniguruma.h>>>>
]> ]
]> ] #ifdef HAVE_STDARG_PROTOTYPES
]> ] # define PV_(args) args
]> ] #else
]> ]>>>> # define PV_(args) ()
]> ] #endif
]> ] #endif
]> ]
]> ]That makes:
]> ]
]> ]<<<<  RegularExpressionDxe.i >>>>
]> ]
]> ]int onig_init (void);
]> ]extern
]> ]int onig_error_code_to_str ();
]> ]
]> ]
]> ]Am I missing something?
]> 
]> SUSE GCC is built using a patch that adds warning -Wunprototyped-calls,
]> and this patch was never accepted for standard gcc. Some of the developers
]> here test gcc builds on windows using standard gcc, which lacks this
]> warning. That difference might explain why you are the first to encounter
]> this build fail.
]> 
]> Some C++ programmers might be surprised to find standard gcc and Microsoft
]> C compilers accepts the following code, even with gcc -Wall -Wextra and
]> CL /W4:
]> 
]>     int foo ();
]>     int bar (void)
]>         {
]>         return foo (1,2,3);
]>         }
]> 
]> In C++, the foo prototype means no arguments are allowed. But in C, the foo
]> prototype means any number and type of argument are allowed. This big
]> difference in the interpretation of the missing argument list is because
]> modern C still supports pre-C89 code.
]> 
]> The solution to the problem is to add -Wstrict-prototypes to the gcc flag
]> definitions in Conf/tools_def.template. GCC option -Wstrict-prototypes is
]> better suited for edk2 use than -Wunprototyped-calls because edk2 does not
]> support pre-C89 C language. Warning -Wstrict-prototypes will catch more
]> problems than -Wunprototyped-calls. Adding -Wstrict-prototypes will require
]> some function prototype improvements to the edk2 source code. Most of the
]> failing cases -Wstrict-prototypes flags in edk2 are where the developer
]> mistakenly uses prototype foo() where prototype foo(VOID) is needed.
]> 
]> Thanks,
]> Scott
]> 
]> ]Passing this place I encountered a number of similar issues for other
]> ]library modules.
]> ]
]> ]Looks like OnigurumaUefiPort.h must define HAVE_STDARG_PROTOTYPES.
]> ]
]> ]
]> ]On Thu, 2015-10-22 at 17:16 +0000, El-Haj-Mahmoud, Samer wrote:
]> ]> Reviewed-by: Samer El-Haj-Mahmoud <el...@hpe.com>
]> ]> 
]> ]>   
]> ]> -----Original Message-----
]> 
]> <snip>
]> 
]> 


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to