cb424d7448
verify-patch-sanity.py validates every active recipe .patch has internally- consistent hunk line counts — catching the 'malformed patch at line N' failure at commit/CI/preflight time instead of hours into a cook. This cycle hit that class three times (qtwaylandscanner, sddm, xwayland), each only discovered when cookbook tried to apply the patch. Running it across the repo found 29 latent malformed patches (validated against GNU patch: e.g. relibc/P3-sysv-ipc reproduces 'malformed patch at line 22'). They were harmless only because they sit in vendored recipes (baked, not re- applied) — but would fail on any version-bump re-derivation. --fix recounts the hunk headers (body untouched) and repaired all 29. Wired into build-preflight.sh (Phase 1.0D) and redbear-ci.yml, with a unit test (test-patch-sanity.sh). Skips archived/legacy trees and unvalidatable formats (empty placeholders, bare-@@ git hunks).
123 lines
4.4 KiB
Fortran
123 lines
4.4 KiB
Fortran
!RUN: rm -rf %t && mkdir -p %t
|
|
!RUN: %flang_fc1 -fsyntax-only -fhermetic-module-files -DSTEP=1 -J%t %s
|
|
!RUN: %flang_fc1 -fsyntax-only -DSTEP=2 -J%t %s
|
|
!RUN: not %flang_fc1 -fsyntax-only -pedantic -J%t %s 2>&1 | FileCheck %s
|
|
|
|
! Tests that a module captured in a hermetic module file is compatible when
|
|
! USE'd with a module of the same name USE'd directly.
|
|
|
|
#if STEP == 1
|
|
module modfile71a
|
|
! not errors
|
|
integer, parameter :: good_named_const = 123
|
|
integer :: good_var = 1
|
|
type :: good_derived
|
|
integer component
|
|
end type
|
|
procedure(), pointer :: good_proc_ptr
|
|
generic :: gen => bad_subroutine
|
|
! bad, but okay if unused
|
|
integer, parameter :: unused_bad_named_const = 123
|
|
integer :: unused_bad_var = 1
|
|
type :: unused_bad_derived
|
|
integer component
|
|
end type
|
|
procedure(), pointer :: unused_bad_proc_ptr
|
|
! errors
|
|
integer, parameter :: bad_named_const = 123
|
|
integer :: bad_var = 1
|
|
type :: bad_derived
|
|
integer component
|
|
end type
|
|
procedure(), pointer :: bad_proc_ptr
|
|
contains
|
|
subroutine good_subroutine
|
|
end
|
|
subroutine unused_bad_subroutine(x)
|
|
integer x
|
|
end
|
|
subroutine bad_subroutine(x)
|
|
integer x
|
|
end
|
|
end
|
|
|
|
module modfile71b
|
|
use modfile71a ! capture hermetically
|
|
end
|
|
|
|
#elif STEP == 2
|
|
module modfile71a
|
|
! not errors
|
|
integer, parameter :: good_named_const = 123
|
|
integer :: good_var = 1
|
|
type :: good_derived
|
|
integer component
|
|
end type
|
|
procedure(), pointer :: good_proc_ptr
|
|
generic :: gen => bad_subroutine
|
|
! bad, but okay if unused
|
|
integer, parameter :: unused_bad_named_const = 666
|
|
real :: unused_bad_var = 1.
|
|
type :: unused_bad_derived
|
|
real component
|
|
end type
|
|
real, pointer :: unused_bad_proc_ptr
|
|
! errors
|
|
integer, parameter :: bad_named_const = 666
|
|
real :: bad_var = 1.
|
|
type :: bad_derived
|
|
real component
|
|
end type
|
|
real, pointer :: bad_proc_ptr
|
|
contains
|
|
subroutine good_subroutine
|
|
end
|
|
subroutine unused_bad_subroutine(x)
|
|
real x
|
|
end
|
|
subroutine bad_subroutine(x)
|
|
real x
|
|
end
|
|
end
|
|
|
|
#else
|
|
|
|
!CHECK: warning: 'bad_derived' is use-associated from 'bad_derived' in two distinct instances of module 'modfile71a'
|
|
!CHECK: warning: 'bad_named_const' is use-associated from 'bad_named_const' in two distinct instances of module 'modfile71a'
|
|
!CHECK: warning: 'bad_proc_ptr' is use-associated from 'bad_proc_ptr' in two distinct instances of module 'modfile71a'
|
|
!CHECK: warning: 'bad_subroutine' is use-associated from 'bad_subroutine' in two distinct instances of module 'modfile71a'
|
|
!CHECK: warning: 'bad_var' is use-associated from 'bad_var' in two distinct instances of module 'modfile71a'
|
|
!CHECK: warning: 'good_derived' is use-associated from 'good_derived' in two distinct instances of module 'modfile71a'
|
|
!CHECK: warning: 'good_named_const' is use-associated from 'good_named_const' in two distinct instances of module 'modfile71a'
|
|
!CHECK: warning: 'good_proc_ptr' is use-associated from 'good_proc_ptr' in two distinct instances of module 'modfile71a'
|
|
!CHECK: warning: 'good_subroutine' is use-associated from 'good_subroutine' in two distinct instances of module 'modfile71a'
|
|
!CHECK: warning: 'good_var' is use-associated from 'good_var' in two distinct instances of module 'modfile71a'
|
|
!CHECK: warning: 'unused_bad_derived' is use-associated from 'unused_bad_derived' in two distinct instances of module 'modfile71a'
|
|
!CHECK: warning: 'unused_bad_named_const' is use-associated from 'unused_bad_named_const' in two distinct instances of module 'modfile71a'
|
|
!CHECK: warning: 'unused_bad_proc_ptr' is use-associated from 'unused_bad_proc_ptr' in two distinct instances of module 'modfile71a'
|
|
!CHECK: warning: 'unused_bad_subroutine' is use-associated from 'unused_bad_subroutine' in two distinct instances of module 'modfile71a'
|
|
!CHECK: warning: 'unused_bad_var' is use-associated from 'unused_bad_var' in two distinct instances of module 'modfile71a'
|
|
!CHECK: error: Reference to 'bad_derived' is ambiguous
|
|
!CHECK: error: Reference to 'bad_named_const' is ambiguous
|
|
!CHECK: error: Reference to 'bad_var' is ambiguous
|
|
!CHECK: error: Reference to 'bad_proc_ptr' is ambiguous
|
|
!CHECK: error: Reference to 'bad_subroutine' is ambiguous
|
|
!CHECK-NOT: error:
|
|
!CHECK-NOT: warning:
|
|
|
|
program main
|
|
use modfile71a
|
|
use modfile71b
|
|
type(good_derived) goodx
|
|
type(bad_derived) badx
|
|
print *, good_named_const
|
|
good_var = 1
|
|
good_proc_ptr => null()
|
|
call good_subroutine
|
|
print *, bad_named_const
|
|
print *, bad_var
|
|
bad_proc_ptr => null()
|
|
call bad_subroutine(1)
|
|
end
|
|
#endif
|