Skip to content

Update copyright 2018 #1884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cbmc/cbmc_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ void cbmc_parse_optionst::help()
// clang-format off
std::cout <<
"\n"
"* * CBMC " CBMC_VERSION " - Copyright (C) 2001-2017 ";
"* * CBMC " CBMC_VERSION " - Copyright (C) 2001-2018 ";

std::cout << "(" << (sizeof(void *)*8) << "-bit version)";

Expand Down
9 changes: 4 additions & 5 deletions src/goto-analyzer/goto_analyzer_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,18 +807,17 @@ bool goto_analyzer_parse_optionst::process_goto_program(
/// display command line help
void goto_analyzer_parse_optionst::help()
{
std::cout <<
"\n"
"* * GOTO-ANALYZER " CBMC_VERSION " - Copyright (C) 2017 ";
std::cout << "\n"
"* * GOTO-ANALYZER " CBMC_VERSION " - Copyright (C) 2017-2018 ";

std::cout << "(" << (sizeof(void *)*8) << "-bit version)";

std::cout << " * *\n";

// clang-format off
std::cout <<
"* * Daniel Kroening, DiffBlue * *\n"
"* * [email protected] * *\n"
"* * Daniel Kroening, DiffBlue * *\n"
"* * [email protected] * *\n"
"\n"
"Usage: Purpose:\n"
"\n"
Expand Down
2 changes: 1 addition & 1 deletion src/goto-programs/lazy_goto_functions_map.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2017 Diffblue Limited. All Rights Reserved.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There really should be a CI job that reminds people about this. Here's a script, slightly adapted from a different project:

#!/bin/bash
set -e -u -o pipefail

script=$(readlink -e "$0")
scriptdir=$(dirname "$script")

if [[ $# -gt 1 ]]
then
	echo "$script accepts at most one commit as argument" 1>&2
	exit 1
fi

if [[ $# -eq 1 ]]
then
	# specific revision requested
	commit=$(git rev-parse $1)
elif git diff HEAD --quiet --ignore-submodules=all
then
	# there are no changes in the working tree
	commit=$(git rev-parse HEAD)
else
	# check local, uncommitted modifications
	commit=
fi

if [[ -n $commit ]]
then
	# specific revision
	echo ">>> Checking commit $commit"
	year=$(git log -1 --pretty=format:%ad --date=short $commit | cut -f1 -d-)
	git_diff_cmd="git diff-tree -r $commit"
else
	# go for working tree
	echo ">>> Checking worktree"
	year=$(date +%Y)
	git_diff_cmd="git diff-index HEAD"
fi

# List all files that have been modified in the commit (or in the working tree)
# file names with spaces will cause trouble in more than one place and are
# NOT supported
function list_modified_files {
	$git_diff_cmd --no-commit-id --name-status \
		--ignore-submodules --diff-filter=ACMR \
		| (egrep '(\.cpp|\.[ch]|\.sh|Makefile)$' || true) | awk '{ print $2 }'
}

# Enumerate all years covered by copyright sequences/ranges, such as
# 2012, 2013, 2015-2017 (which would yield 2012 2013 2015 2016 2017)
function enum_years {
	local years=$1
	years=${years// /}
	ifs=$IFS
	IFS=,
	for interval in $years ; do
		if [[ $interval =~ "-" ]] ; then
			seq ${interval/-/,}
		else
			echo $interval
		fi
	done
	IFS=$ifs
}

yearpat="([[:digit:]]{4}(-[[:digit:]]{4})?,[[:space:]]+)*([[:digit:]]{4}-)?[[:digit:]]{4}"

ec=0
for f in $(list_modified_files)
do
	if ! git grep -qE \
		"Copyright[[:space:]]+$yearpat[[:space:]]+Diffblue Limited" \
		$commit -- $f; then
		echo "$f: needs copyright notice" 1>&2
		ec=1
	else
		copyright_years=$(git grep -E \
			"Copyright[[:space:]]+$yearpat[[:space:]]+Diffblue Limited" \
			$commit -- $f \
			| sed -e 's/.*Copyright[[:space:]]*//' \
				-e 's/ Diffblue Limited.*//')
		if ! enum_years "$copyright_years" | grep -wq $year
		then
			echo "$f: needs copyright update" 1>&2
			ec=1
		fi
	fi
done
exit $ec

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this script doing exactly? I agree that doing this manually isn't great, on the other hand, it's just once a year.

Copy link
Collaborator

@tautschnig tautschnig Feb 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ideally run as a commit hook to check whether you making any changes in some file should also induce an update to the copyright information. Yes, it's once a year, but it requires looking at the top of each file every time you make a modification to see whether the copyright info needs to be updated.

Edit: what is this script doing? It will just print ": needs copyright update" when that is the case. It could become a Travis job.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, sounds good. I'll suggest adding this script to our Travis installation in a separate PR.

// Copyright 2016-2018 Diffblue Limited. All Rights Reserved.

/// \file
/// A lazy wrapper for goto_functionst.
Expand Down
2 changes: 1 addition & 1 deletion src/goto-programs/lazy_goto_model.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017 Diffblue Limited. All Rights Reserved.
// Copyright 2017-2018 Diffblue Limited. All Rights Reserved.

/// \file
/// Model for lazy loading of functions
Expand Down
2 changes: 1 addition & 1 deletion src/goto-programs/lazy_goto_model.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2017 Diffblue Limited. All Rights Reserved.
// Copyright 2016-2018 Diffblue Limited. All Rights Reserved.

/// \file
/// Model for lazy loading of functions
Expand Down
2 changes: 1 addition & 1 deletion src/jbmc/jbmc_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Author: Daniel Kroening, [email protected]

JBMC
Bounded Model Checking for Java
Copyright (C) 2017 Daniel Kroening <[email protected]>
Copyright (C) 2017-2018 Daniel Kroening <[email protected]>

*/

Expand Down
5 changes: 2 additions & 3 deletions src/jbmc/jbmc_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -817,9 +817,8 @@ bool jbmc_parse_optionst::process_goto_functions(
/// display command line help
void jbmc_parse_optionst::help()
{
std::cout <<
"\n"
"* * JBMC " CBMC_VERSION " - Copyright (C) 2001-2017 ";
std::cout << "\n"
"* * JBMC " CBMC_VERSION " - Copyright (C) 2001-2018 ";

std::cout << "(" << (sizeof(void *)*8) << "-bit version)";

Expand Down
2 changes: 1 addition & 1 deletion src/util/journalling_symbol_table.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

// Copyright 2016-2017 DiffBlue Limited. All Rights Reserved.
// Copyright 2016-2018 DiffBlue Limited. All Rights Reserved.

/// \file
/// A symbol table writer that records which entries have been updated
Expand Down
2 changes: 1 addition & 1 deletion src/util/symbol_table.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2017 Diffblue Limited. All Rights Reserved.
// Copyright 2016-2018 Diffblue Limited. All Rights Reserved.

#include "symbol_table.h"

Expand Down
2 changes: 1 addition & 1 deletion src/util/symbol_table.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2017 Diffblue Limited. All Rights Reserved.
// Copyright 2016-2018 Diffblue Limited. All Rights Reserved.

/// \file
/// Symbol table
Expand Down
2 changes: 1 addition & 1 deletion src/util/symbol_table_base.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017 Diffblue Limited. All Rights Reserved.
// Copyright 2017-2018 Diffblue Limited. All Rights Reserved.

#include "symbol_table_base.h"

Expand Down
2 changes: 1 addition & 1 deletion src/util/symbol_table_base.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017 Diffblue Limited. All Rights Reserved.
// Copyright 2017-2018 Diffblue Limited. All Rights Reserved.

/// \file
/// Symbol table base class interface
Expand Down