From ddb99a570e41f4028a95ecd6d517452e65d9b1d6 Mon Sep 17 00:00:00 2001 From: Pascal Obry Date: Wed, 11 Mar 2015 17:22:42 +0100 Subject: [PATCH] Fix check for copyright presence in multi-line comments. --- regtests/copyright.c | 6 ++++++ regtests/makefile | 2 ++ regtests/out28.out | 0 src/style_checker.adb | 2 +- 4 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 regtests/copyright.c create mode 100644 regtests/out28.out diff --git a/regtests/copyright.c b/regtests/copyright.c new file mode 100644 index 0000000..f6fd74c --- /dev/null +++ b/regtests/copyright.c @@ -0,0 +1,6 @@ +/* + * + * Copyright (C) 2015, SuperCorp + * + * + */ diff --git a/regtests/makefile b/regtests/makefile index 6583efe..eae0af9 100644 --- a/regtests/makefile +++ b/regtests/makefile @@ -45,6 +45,7 @@ run_tests: -../style_checker -Hw withuse4.adb > out25.res 2>&1 -../style_checker -Hw aspect.adb > out26.res 2>&1 -../style_checker -Hw -o andthennot.adb > out27.res 2>&1 + -../style_checker -h6 -cp copyright.c > out28.res 2>&1 check_results: echo "### regressions follows" @@ -76,6 +77,7 @@ check_results: -diff -wc out25.out out25.res || echo $$? >> out_status.res -diff -wc out26.out out26.res || echo $$? >> out_status.res -diff -wc out27.out out27.res || echo $$? >> out_status.res + -diff -wc out28.out out28.res || echo $$? >> out_status.res test ! -e out_status.res clean: diff --git a/regtests/out28.out b/regtests/out28.out new file mode 100644 index 0000000..e69de29 diff --git a/src/style_checker.adb b/src/style_checker.adb index c090ddd..c007b55 100644 --- a/src/style_checker.adb +++ b/src/style_checker.adb @@ -310,7 +310,7 @@ procedure Style_Checker is if (Checker.Lang.Get_Copyright_Present or else Checker.Lang.Get_Copyright_Year) and then Cp_Start /= 0 - and then Co_Start /= 0 + and then (Co_Start /= 0 or else Checker.Multiline_Comment) and then Cp_Start > Co_Start then Checker.Copyright_Found := True; -- 2.11.4.GIT