[edk2-devel] [PATCH V2] BaseTools:improve code to support C files with .C suffixes

Leif Lindholm leif.lindholm at linaro.org
Wed May 8 09:09:26 UTC 2019


On Tue, May 07, 2019 at 07:01:26PM -0700, Andrew Fish wrote:
> 
> 
> > On May 7, 2019, at 7:40 AM, Leif Lindholm <leif.lindholm at linaro.org> wrote:
> > 
> > Hi Fan Zhiju,
> > 
> > But where does the string come from that contains a .C suffix?
> > Is the tool internally converting things to uppercase, or is some
> > source file in the build incorrectly named?
> > 
> 
> Leif,
> 
> Our build system defines .C as correct! I think it has been that way a very long time. 

.C is valid, but at least for GCC it is equivalent to all of the other
non-.c options - i.e., interpret as c++. Which is why I am wondering
about the case that ends up with the build system internally
processing this.

If it is changed to permitting .C files to be compiled as C instead of
C++ (which the patch seems to imply), that sounds incorrect to me.

/
    Leif

> https://github.com/tianocore/edk2/blob/master/BaseTools/Conf/build_rule.template#L109
> 
> [C-Code-File]
>     <InputFile>
>         ?.c
>         ?.C
>         ?.cc
>         ?.CC
>         ?.cpp
>         ?.Cpp
>         ?.CPP
> 
> Thanks,
> 
> Andrew Fish
> 
> 
> > I am asking because it is not clear to me whether the patch resolves a
> > problem or hides one.
> > 
> > Best Regards,
> > 
> > Leif
> > 
> > On Tue, May 07, 2019 at 03:05:02AM +0000, Fan, ZhijuX wrote:
> >> This problem has nothing to do with the file system, We just use the
> >> filename as a string to compare with other strings
> >> Our unittest tested minplatform, Ovmf. This problem was found when
> >> building a platform inside Intel.
> >> We've tested it on Linux and Windows.
> >> 
> >> Any question, please let me know. Thanks.
> >> 
> >> Best Regards
> >> Fan Zhiju
> >> 
> >> -----Original Message-----
> >> From: afish at apple.com [mailto:afish at apple.com] 
> >> Sent: Tuesday, May 7, 2019 10:31 AM
> >> To: devel at edk2.groups.io; Fan, ZhijuX <zhijux.fan at intel.com>
> >> Cc: Gao, Liming <liming.gao at intel.com>; Feng, Bob C <bob.c.feng at intel.com>
> >> Subject: Re: [edk2-devel] [PATCH V2] BaseTools:improve code to support C files with .C suffixes
> >> 
> >> This brings up a question? Do we tests on a file system that is case sensitive? Is this just lack of a test case?
> >> 
> >> Thanks,
> >> 
> >> Andrew Fish
> >> 
> >>> On May 6, 2019, at 7:22 PM, Fan, ZhijuX <zhijux.fan at intel.com> wrote:
> >>> 
> >>> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1773
> >>> 
> >>> Build break if C file suffixes of named .C instead of .c Code not 
> >>> recognize filenames with .C suffixes.
> >>> 
> >>> This patch adds code to Support both .c file and .C file
> >>> 
> >>> Cc: Bob Feng <bob.c.feng at intel.com>
> >>> Cc: Liming Gao <liming.gao at intel.com>
> >>> Signed-off-by: Zhiju.Fan <zhijux.fan at intel.com>
> >>> ---
> >>> BaseTools/Source/Python/AutoGen/GenMake.py | 3 ++-
> >>> 1 file changed, 2 insertions(+), 1 deletion(-)
> >>> 
> >>> diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py 
> >>> b/BaseTools/Source/Python/AutoGen/GenMake.py
> >>> index 0e0f9fd9b0..858ddedf8e 100644
> >>> --- a/BaseTools/Source/Python/AutoGen/GenMake.py
> >>> +++ b/BaseTools/Source/Python/AutoGen/GenMake.py
> >>> @@ -1035,7 +1035,8 @@ cleanlib:
> >>>                        CmdTargetDict[CmdSign] = "%s %s" % (CmdTargetDict[CmdSign], SingleCommandList[-1])
> >>>                    Index = CommandList.index(Item)
> >>>                    CommandList.pop(Index)
> >>> -                    if SingleCommandList[-1].endswith("%s%s.c" % (TAB_SLASH, CmdSumDict[CmdSign.lstrip('/Fo').rsplit(TAB_SLASH, 1)[0]])):
> >>> +                    if SingleCommandList[-1].endswith("%s%s.c" % (TAB_SLASH, CmdSumDict[T.Target.SubDir])) or \
> >>> +                            SingleCommandList[-1].endswith("%s%s.C" % (TAB_SLASH, CmdSumDict[T.Target.SubDir])):
> >>>                        Cpplist = CmdCppDict[T.Target.SubDir]
> >>>                        Cpplist.insert(0, '$(OBJLIST_%d): $(COMMON_DEPS)' % list(self.ObjTargetDict.keys()).index(T.Target.SubDir))
> >>>                        T.Commands[Index] = '%s\n\t%s' % (' 
> >>> \\\n\t'.join(Cpplist), CmdTargetDict[CmdSign])
> >>> --
> >>> 2.14.1.windows.1
> >>> 
> >>> 
> >>> 
> >>> 
> >>> <winmail.dat>
> >> 
> >> 
> >> 
> >> 
> > 
> > 
> 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#40188): https://edk2.groups.io/g/devel/message/40188
Mute This Topic: https://groups.io/mt/31539232/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list