Accepting request 148164 from devel:tools:compiler

- Add pre-generated doc files, remove sphinx dependency 

- pr14795.patch: Fix incorrect line numbers after -frewrite-includes
  (PR#14795)
- pr14831.patch: Do not incorrectly warn about pragmas in -frewrite-includes
  (PR#14831)

- disable cross-compile mode in stage2 for armv5/v7

OBS-URL: https://build.opensuse.org/request/show/148164
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/llvm?expand=0&rev=40
This commit is contained in:
Stephan Kulow 2013-01-13 13:29:06 +00:00 committed by Git OBS Bridge
commit b918fbdde4
5 changed files with 173 additions and 31 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:af496741ab0e11a3ebe0355251a0c626964d7ea1b39734a207bd27932703a55c
size 17651967
oid sha256:9438b98fdd9739fbceec5f6dd852fc0b1c99b78513e27f453b8d8647059a76b4
size 19632648

View File

@ -1,3 +1,21 @@
-------------------------------------------------------------------
Fri Jan 11 11:56:09 UTC 2013 - idonmez@suse.com
- Add pre-generated doc files, remove sphinx dependency
-------------------------------------------------------------------
Tue Jan 8 15:16:56 UTC 2013 - llunak@suse.com
- pr14795.patch: Fix incorrect line numbers after -frewrite-includes
(PR#14795)
- pr14831.patch: Do not incorrectly warn about pragmas in -frewrite-includes
(PR#14831)
-------------------------------------------------------------------
Mon Dec 31 09:29:12 UTC 2012 - dmueller@suse.com
- disable cross-compile mode in stage2 for armv5/v7
-------------------------------------------------------------------
Thu Dec 20 14:51:18 UTC 2012 - idonmez@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package llvm
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -44,6 +44,8 @@ Patch6: arm_suse_support.diff
Patch7: disable_neon_in_armv7.diff
# PATCH-FIX-UPSTREAM python-ulimit.patch Upstream r169695
Patch8: python-ulimit.patch
Patch9: pr14795.patch
Patch10: pr14831.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: autoconf
BuildRequires: automake
@ -64,7 +66,6 @@ BuildRequires: glibc-devel-32bit
BuildRequires: libffi-devel
BuildRequires: libtool
BuildRequires: python-base
BuildRequires: python-sphinx
# llvm does not work on ppc, only ppc64
ExcludeArch: ppc
@ -142,6 +143,8 @@ This package contains vim plugins for LLVM like syntax highlighting.
%patch7 -p0
%endif
%patch8 -p1
%patch9 -p0
%patch10 -p0
# We hardcode i586
rm tools/clang/test/Driver/x86_features.c
@ -174,31 +177,29 @@ mkdir Release
ln -s lib Release/lib64
%endif
%ifarch armv7l armv7hl
# This fixes the armv7 build. (Allow to run stage2 without problem)
export CFLAGS="-mfloat-abi=hard -march=armv7-a -mtune=cortex-a9 -mfpu=vfpv3-d16"
export CXXFLAGS="-mfloat-abi=hard -march=armv7-a -mtune=cortex-a9 -mfpu=vfpv3-d16"
%endif
../configure \
--enable-optimized \
--disable-assertions \
--with-optimize-option="-O0" \
%ifarch armv5el armv5tel
%ifarch %arm
--disable-sjlj-exceptions \
--with-arch=armv5te --with-float=soft --with-mode=arm \
--disable-werror --enable-checking=release \
%ifarch armv5el armv5tel
--with-arch=armv5te --with-float=soft --with-mode=arm \
--build=armv5tel-suse-linux-gnueabi --host=armv5tel-suse-linux-gnueabi --target=armv5tel-suse-linux-gnueabi \
%endif
%ifarch armv7l armv7hl
--disable-sjlj-exceptions \
--with-arch=armv7-a --with-tune=cortex-a9 --with-float=hard --with-fpu=vfpv3-d16 --with-fpmath=vfp3 \
--disable-werror --enable-checking=release \
--with-arch=armv7-a \
--with-tune=cortex-a9 \
--with-float=hard \
--with-fpu=vfpv3-d16 \
--with-abi=aapcs-vfp \
--build=armv7hl-suse-linux-gnueabi --host=armv7hl-suse-linux-gnueabi --target=armv7hl-suse-linux-gnueabi \
%if 0%{?suse_version} >= 1220
--with-mode=thumb \
--with-mode=thumb \
%else
--with-mode=arm \
--with-mode=arm \
%endif
%endif
%endif
--enable-targets=host
@ -217,34 +218,43 @@ ln -s lib Release+Debug/lib64
export CC=$TOPLEVEL/stage1/Release/bin/clang
export CXX=$TOPLEVEL/stage1/Release/bin/clang++
%ifarch armv7l armv7hl
# This fixes the armv7 build. (Allow to run stage2 without problem)
export CFLAGS="-mfloat-abi=hard -march=armv7-a -mtune=cortex-a9 -mfpu=vfpv3-d16"
export CXXFLAGS="-mfloat-abi=hard -march=armv7-a -mtune=cortex-a9 -mfpu=vfpv3-d16"
%endif
../configure \
--prefix=%{_prefix} \
--enable-optimized \
--disable-assertions \
--enable-pic \
--disable-timestamps \
--enable-targets=%{_supported_archs} \
%if 0%{?suse_version} >= 1220
--with-binutils-include=/usr/include \
%endif
%ifarch armv5el armv5tel
%ifarch %arm
--with-optimize-option="-U_GLIBCXX_ATOMIC_BUILTINS" \
--disable-sjlj-exceptions \
--with-arch=armv5te --with-float=soft --with-mode=arm \
--disable-werror --enable-checking=release \
--build=armv5tel-suse-linux-gnueabi --host=armv5tel-suse-linux-gnueabi --target=armv5tel-suse-linux-gnueabi \
%ifarch armv5el armv5tel
--with-arch=armv5te --with-float=soft --with-mode=arm \
%endif
%ifarch armv7l armv7hl
--with-optimize-option="-U_GLIBCXX_ATOMIC_BUILTINS" \
--disable-sjlj-exceptions \
--with-arch=armv7-a --with-tune=cortex-a9 --with-float=hard --with-fpu=vfpv3-d16 --with-fpmath=vfp3 \
--with-arch=armv7-a \
--with-tune=cortex-a9 \
--with-float=hard \
--with-fpu=vfpv3-d16 \
--with-abi=aapcs-vfp \
%if 0%{?suse_version} >= 1220
--with-mode=thumb \
%else
--with-mode=arm \
%endif
--disable-werror --enable-checking=release \
--build=armv7hl-suse-linux-gnueabi --host=armv7hl-suse-linux-gnueabi --target=armv7hl-suse-linux-gnueabi \
%endif
--enable-targets=arm \
%else
--enable-targets=%{_supported_archs} \
%endif
--with-clang-resource-dir="../%{_lib}/clang/%{_release_version}" \
--enable-debug-symbols \
@ -273,13 +283,12 @@ mv %{buildroot}%{_prefix}/lib %{buildroot}%{_prefix}/lib64
# Build man/html pages
cd docs
make -f Makefile.sphinx html man
# Docs are prebuilt due to sphinx dependency -- cartman
#make -f Makefile.sphinx html man
rm -rf %{buildroot}/usr/docs
mkdir -p %{buildroot}%{_docdir}/llvm
gzip _build/man/*.1
mv _build/man/* %{buildroot}/usr/share/man/man1
mv _build/html/* %{buildroot}%{_docdir}/llvm/
rm -rf _build
cp -r _build/man/* %{buildroot}/usr/share/man/man1
cp -r _build/html/* %{buildroot}%{_docdir}/llvm/
cd ../tools/clang/docs
mkdir -p %{buildroot}%{_docdir}/llvm-clang/html

76
pr14795.patch Normal file
View File

@ -0,0 +1,76 @@
From 6be9a72888dd0ed22f53c5d46773aa188c0873c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= <l.lunak@suse.cz>
Date: Fri, 4 Jan 2013 21:10:49 +0100
Subject: [PATCH] fix line info in -frewrite-includes after skipped #if block
---
lib/Rewrite/Frontend/InclusionRewriter.cpp | 20 +++++++++++++++++++-
test/Frontend/rewrite-includes.c | 2 ++
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/lib/Rewrite/Frontend/InclusionRewriter.cpp b/lib/Rewrite/Frontend/InclusionRewriter.cpp
index 9d1bec9..91dabcc 100644
--- tools/clang/lib/Rewrite/Frontend/InclusionRewriter.cpp
+++ tools/clang/lib/Rewrite/Frontend/InclusionRewriter.cpp
@@ -275,14 +275,21 @@ bool InclusionRewriter::Process(FileID FileId,
// TODO: Consider adding a switch that strips possibly unimportant content,
// such as comments, to reduce the size of repro files.
+ bool NeedLineInfo = false;
while (RawToken.isNot(tok::eof)) {
+ if (RawToken.isAtStartOfLine() && NeedLineInfo) {
+ OutputContentUpTo(FromFile, NextToWrite,
+ SM.getFileOffset(RawToken.getLocation()), EOL, Line);
+ WriteLineInfo(FileName, Line, FileType, EOL);
+ NeedLineInfo = false;
+ }
if (RawToken.is(tok::hash) && RawToken.isAtStartOfLine()) {
RawLex.setParsingPreprocessorDirective(true);
Token HashToken = RawToken;
RawLex.LexFromRawLexer(RawToken);
if (RawToken.is(tok::raw_identifier))
PP.LookUpIdentifierInfo(RawToken);
- if (RawToken.is(tok::identifier)) {
+ if (RawToken.getIdentifierInfo() != NULL) {
switch (RawToken.getIdentifierInfo()->getPPKeywordID()) {
case tok::pp_include:
case tok::pp_include_next:
@@ -323,6 +330,17 @@ bool InclusionRewriter::Process(FileID FileId,
}
break;
}
+ case tok::pp_endif:
+ case tok::pp_elif:
+ case tok::pp_else: {
+ // We surround every #include by #if 0 to comment it out, but that
+ // changes line numbers. These are fixed up right after that, but
+ // the whole #include could be inside a preprocessor conditional
+ // that is not processed. So it is necessary to fix the line
+ // numbers one the next line after each #else/#endif as well.
+ NeedLineInfo = true;
+ break;
+ }
default:
break;
}
diff --git a/test/Frontend/rewrite-includes.c b/test/Frontend/rewrite-includes.c
index 546a2c4..f2f929c 100644
--- tools/clang/test/Frontend/rewrite-includes.c
+++ tools/clang/test/Frontend/rewrite-includes.c
@@ -47,11 +47,13 @@ A(1,2)
// CHECK-NEXT: {{^}}included_line3{{$}}
// CHECK-NEXT: {{^}}# 10 "{{.*}}rewrite-includes.c" 2{{$}}
// CHECK-NEXT: {{^}}#else{{$}}
+// CHECK-NEXT: {{^}}# 11 "{{.*}}rewrite-includes.c"{{$}}
// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}}
// CHECK-NEXT: {{^}}#include "rewrite-includes4.h"{{$}}
// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}}
// CHECK-NEXT: {{^}}# 12 "{{.*}}rewrite-includes.c"{{$}}
// CHECK-NEXT: {{^}}#endif{{$}}
+// CHECK-NEXT: {{^}}# 13 "{{.*}}rewrite-includes.c"{{$}}
// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}}
// CHECK-NEXT: {{^}}#/**/include /**/ "rewrite-includes5.h" /**/ {{\\}}{{$}}
// CHECK-NEXT: {{^}} {{$}}
--
1.7.10.4

39
pr14831.patch Normal file
View File

@ -0,0 +1,39 @@
From 08c9add28c1a5b3c80b910d268a2f0a9f4d72995 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= <l.lunak@suse.cz>
Date: Mon, 7 Jan 2013 12:37:28 +0100
Subject: [PATCH] do not warn about "unknown" pragmas in -frewrite-includes
(pr#14831)
---
lib/Rewrite/Frontend/InclusionRewriter.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lib/Rewrite/Frontend/InclusionRewriter.cpp b/lib/Rewrite/Frontend/InclusionRewriter.cpp
index 9d1bec9..dad15fa 100644
--- tools/clang/lib/Rewrite/Frontend/InclusionRewriter.cpp
+++ tools/clang/lib/Rewrite/Frontend/InclusionRewriter.cpp
@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include "clang/Rewrite/Frontend/Rewriters.h"
+#include "clang/Lex/Pragma.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Frontend/PreprocessorOutputOptions.h"
@@ -344,6 +345,13 @@ void clang::RewriteIncludesInInput(Preprocessor &PP, raw_ostream *OS,
InclusionRewriter *Rewrite = new InclusionRewriter(PP, *OS,
Opts.ShowLineMarkers);
PP.addPPCallbacks(Rewrite);
+ // Ignore all pragmas, otherwise there will be warnings about unknown pragmas
+ // (because there's nothing to handle them).
+ PP.AddPragmaHandler(new EmptyPragmaHandler());
+ // Ignore also all pragma in all namespaces created
+ // in Preprocessor::RegisterBuiltinPragmas().
+ PP.AddPragmaHandler("GCC",new EmptyPragmaHandler());
+ PP.AddPragmaHandler("clang",new EmptyPragmaHandler());
// First let the preprocessor process the entire file and call callbacks.
// Callbacks will record which #include's were actually performed.
--
1.7.10.4