[Git][ghc/ghc][wip/T16738] 5 commits: gitlab-ci: Fix submodule linting of commits

Ben Gamari gitlab at gitlab.haskell.org
Sun Jun 9 14:08:32 UTC 2019



Ben Gamari pushed to branch wip/T16738 at Glasgow Haskell Compiler / GHC


Commits:
4a72259d by Ben Gamari at 2019-06-08T18:40:55Z
gitlab-ci: Fix submodule linting of commits

There is no notion of a base commit when we aren't checking a merge
request. Just check the HEAD commit.

- - - - -
87540029 by Ben Gamari at 2019-06-08T20:44:55Z
gitlab-ci: Ensure that all commits on a branch are submodule-linted

The previous commit reworked things such that the submodule linter would
only run on the head commit. However, the linter only checks the
submodules which are touched by the commits it is asked to lint.
Consequently it would be possible for a bad submodule to sneak through.

Thankfully, we can use the handy CI_COMMIT_BEFORE_SHA attribute to
find the base commit of the push.

- - - - -
54a61a85 by Ben Gamari at 2019-06-09T14:08:25Z
testsuite: Omit profasm way for cc017

cc017 requires TH but we can't load dynamic profiled objects.

- - - - -
988c1c1f by Ben Gamari at 2019-06-09T14:08:25Z
testsuite: Mark T16180 as broken in ghci way

addForeignSource is currently not supported in GHCi.

- - - - -
e13091de by Ben Gamari at 2019-06-09T14:08:25Z
Fix uses of #ifdef/#ifndef

The linter now enforces our preference for `#if defined()` and
`#if !defined()`.

- - - - -


6 changed files:

- .gitlab-ci.yml
- aclocal.m4
- hadrian/src/Rules/Generate.hs
- includes/ghc.mk
- testsuite/tests/ffi/should_compile/all.T
- testsuite/tests/th/all.T


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -79,19 +79,12 @@ ghc-linters:
   script:
     - git fetch "$CI_MERGE_REQUEST_PROJECT_URL" $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
     - base="$(git merge-base FETCH_HEAD $CI_COMMIT_SHA)"
-    - "echo Linting changes between $base..$CI_COMMIT_SHA"
+    - "echo Linting submodule changes between $base..$CI_COMMIT_SHA"
     - submodchecker .git $(git rev-list $base..$CI_COMMIT_SHA)
   dependencies: []
   tags:
     - lint
 
-lint-submods:
-  extends: .lint-submods
-  only:
-    refs:
-      - master
-      - /ghc-[0-9]+\.[0-9]+/
-
 lint-submods-marge:
   extends: .lint-submods
   only:
@@ -112,6 +105,16 @@ lint-submods-mr:
     variables:
       - $CI_MERGE_REQUEST_LABELS =~ /.*wip/marge_bot_batch_merge_job.*/
 
+lint-submods-branch:
+  extends: .lint-submods
+  script:
+    - "echo Linting submodule changes between $CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA"
+    - submodchecker .git $(git rev-list $CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA)
+  only:
+    refs:
+      - master
+      - /ghc-[0-9]+\.[0-9]+/
+
 .lint-changelogs:
   stage: lint
   image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"


=====================================
aclocal.m4
=====================================
@@ -866,7 +866,7 @@ case $TargetPlatform in
       esac ;;
     i386-unknown-mingw32) fptools_cv_leading_underscore=yes;;
     x86_64-unknown-mingw32) fptools_cv_leading_underscore=no;;
-    *) AC_RUN_IFELSE([AC_LANG_SOURCE([[#ifdef HAVE_NLIST_H
+    *) AC_RUN_IFELSE([AC_LANG_SOURCE([[#if defined(HAVE_NLIST_H)
 #include <nlist.h>
 struct nlist xYzzY1[] = {{"xYzzY1", 0},{0}};
 struct nlist xYzzY2[] = {{"_xYzzY2", 0},{0}};
@@ -876,7 +876,7 @@ int main(argc, argv)
 int argc;
 char **argv;
 {
-#ifdef HAVE_NLIST_H
+#if defined(HAVE_NLIST_H)
     if(nlist(argv[0], xYzzY1) == 0 && xYzzY1[0].n_value != 0)
         exit(1);
     if(nlist(argv[0], xYzzY2) == 0 && xYzzY2[0].n_value != 0)
@@ -1650,16 +1650,16 @@ then
     [fptools_cv_timer_create_works],
     [AC_TRY_RUN([
 #include <stdio.h>
-#ifdef HAVE_STDLIB_H
+#if defined(HAVE_STDLIB_H)
 #include <stdlib.h>
 #endif
-#ifdef HAVE_TIME_H
+#if defined(HAVE_TIME_H)
 #include <time.h>
 #endif
-#ifdef HAVE_SIGNAL_H
+#if defined(HAVE_SIGNAL_H)
 #include <signal.h>
 #endif
-#ifdef HAVE_UNISTD_H
+#if defined(HAVE_UNISTD_H)
 #include <unistd.h>
 #endif
 


=====================================
hadrian/src/Rules/Generate.hs
=====================================
@@ -233,7 +233,7 @@ generateGhcPlatformH = do
     targetVendor   <- getSetting TargetVendor
     ghcUnreg       <- getFlag    GhcUnregisterised
     return . unlines $
-        [ "#ifndef __GHCPLATFORM_H__"
+        [ "#if !defined(__GHCPLATFORM_H__)"
         , "#define __GHCPLATFORM_H__"
         , ""
         , "#define BuildPlatform_TYPE  " ++ cppify hostPlatform
@@ -386,7 +386,7 @@ generateGhcAutoconfH = do
     ccLlvmBackend    <- getSetting CcLlvmBackend
     ccClangBackend   <- getSetting CcClangBackend
     return . unlines $
-        [ "#ifndef __GHCAUTOCONF_H__"
+        [ "#if !defined(__GHCAUTOCONF_H__)")
         , "#define __GHCAUTOCONF_H__" ]
         ++ configHContents ++
         [ "\n#define TABLES_NEXT_TO_CODE 1" | tablesNextToCode && not ghcUnreg ]
@@ -422,7 +422,7 @@ generateGhcBootPlatformH = do
     targetOs       <- getSetting TargetOs
     targetVendor   <- getSetting TargetVendor
     return $ unlines
-        [ "#ifndef __PLATFORM_H__"
+        [ "#if !defined(__PLATFORM_H__)")
         , "#define __PLATFORM_H__"
         , ""
         , "#define BuildPlatform_NAME  " ++ show buildPlatform
@@ -464,10 +464,10 @@ generateGhcVersionH = do
     patchLevel1 <- getSetting ProjectPatchLevel1
     patchLevel2 <- getSetting ProjectPatchLevel2
     return . unlines $
-        [ "#ifndef __GHCVERSION_H__"
+        [ "#if !defined(__GHCVERSION_H__)")
         , "#define __GHCVERSION_H__"
         , ""
-        , "#ifndef __GLASGOW_HASKELL__"
+        , "#if !defined(__GLASGOW_HASKELL__)")
         , "# define __GLASGOW_HASKELL__ " ++ version
         , "#endif"
         , ""]


=====================================
includes/ghc.mk
=====================================
@@ -57,7 +57,7 @@ endif
 
 $(includes_H_VERSION) : mk/project.mk | $$(dir $$@)/.
 	@echo "Creating $@..."
-	@echo "#ifndef __GHCVERSION_H__"  > $@
+	@echo "#if !defined(__GHCVERSION_H__)"  > $@)
 	@echo "#define __GHCVERSION_H__" >> $@
 	@echo >> $@
 	@echo "#define __GLASGOW_HASKELL__ $(ProjectVersionInt)" >> $@
@@ -92,7 +92,7 @@ else
 
 $(includes_H_CONFIG) : mk/config.h mk/config.mk includes/ghc.mk | $$(dir $$@)/.
 	@echo "Creating $@..."
-	@echo "#ifndef __GHCAUTOCONF_H__"  >$@
+	@echo "#if !defined(__GHCAUTOCONF_H__)"  >$@)
 	@echo "#define __GHCAUTOCONF_H__" >>$@
 #
 #	Copy the contents of mk/config.h, turning '#define PACKAGE_FOO
@@ -125,7 +125,7 @@ endif
 $(includes_H_PLATFORM) : includes/Makefile | $$(dir $$@)/.
 	$(call removeFiles,$@)
 	@echo "Creating $@..."
-	@echo "#ifndef __GHCPLATFORM_H__"  >$@
+	@echo "#if !defined(__GHCPLATFORM_H__)"  >$@)
 	@echo "#define __GHCPLATFORM_H__" >>$@
 	@echo >> $@
 	@echo "#define BuildPlatform_TYPE  $(HostPlatform_CPP)" >> $@


=====================================
testsuite/tests/ffi/should_compile/all.T
=====================================
@@ -35,7 +35,8 @@ test('T11983', [omit_ways(['ghci'])], compile, ['T11983.c'])
 test('T14125', normal, compile, [''])
 test(
     'cc017',
-    normal,
+    # We need TH but can't load profiled dynamic objects
+    when(ghc_dynamic(), omit_ways(['profasm'])),
     compile,
     [
         '-optc=-DC -optcxx=-DCXX -optcxx=-std=c++11'


=====================================
testsuite/tests/th/all.T
=====================================
@@ -467,7 +467,7 @@ test('T15437', expect_broken(15437), multimod_compile,
 test('T15985', normal, compile, [''])
 test('T16133', normal, compile_fail, [''])
 test('T15471', normal, multimod_compile, ['T15471.hs', '-v0'])
-test('T16180', normal, compile_and_run, [''])
+test('T16180', expect_broken_for(16743, ['ghci']), compile_and_run, [''])
 test('T16183', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
 test('T16195', normal, multimod_compile, ['T16195.hs', '-v0'])
 test('T16293b', normal, compile, [''])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/0f4169ae350ebd5514855c3756f55d574fef2a6b...e13091deaff093461d18e049c8eb2e87fc804436

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/0f4169ae350ebd5514855c3756f55d574fef2a6b...e13091deaff093461d18e049c8eb2e87fc804436
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190609/de6b4fe7/attachment-0001.html>


More information about the ghc-commits mailing list