This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
gengtype: emit a more appropriate copyright year in generated files.
- From: Basile Starynkevitch <basile at starynkevitch dot net>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 3 Jan 2011 23:40:36 +0100
- Subject: gengtype: emit a more appropriate copyright year in generated files.
Hello All,
The below patch against trunk rev. 168441 emit the current year in the
copyright notice of gengtype generated files.
############################ patch
Index: gcc/gengtype.c
===================================================================
--- gcc/gengtype.c (revision 168441)
+++ gcc/gengtype.c (working copy)
@@ -1443,7 +1443,7 @@ static outf_p
create_file (const char *name, const char *oname)
{
static const char *const hdr[] = {
- " Copyright (C) 2004, 2007, 2009 Free Software Foundation, Inc.\n",
+ /* The copyright notice and year is emitted separately. */
"\n",
"This file is part of GCC.\n",
"\n",
@@ -1465,15 +1465,24 @@ create_file (const char *name, const char *oname)
};
outf_p f;
size_t i;
-
+ int year = 2010; /* Default the current year to something sensible. */
+ time_t now = 0;
gcc_assert (name != NULL);
gcc_assert (oname != NULL);
f = XCNEW (struct outf);
f->next = output_files;
f->name = oname;
output_files = f;
-
+ time (&now);
+ if (now>0)
+ {
+ struct tm* nowtm = localtime(&now);
+ if (nowtm)
+ year = 1900 + nowtm->tm_year;
+ }
oprintf (f, "/* Type information for %s.\n", name);
+ oprintf (f, " Copyright (C) %d Free Software Foundation, Inc.\n",
+ year);
for (i = 0; i < ARRAY_SIZE (hdr); i++)
oprintf (f, "%s", hdr[i]);
return f;
###### gcc/ChangeLog entry
2011-01-03 Basile Starynkevitch <basile@starynkevitch.net>
* gengtype.c (create_file): Emit current year in copyright notice.
######
See discussion inside http://gcc.gnu.org/ml/gcc-patches/2011-01/msg00085.html
This patch just generate a more intuitive copyright year. It does not handle
more serious legal issues, like is the FSF the copyright owner of every gengtype
generated file (probably not for all plugins using gengtype), and is the generated
gt*.[ch] files always GPLv3+ (a plugin author could choose another licence).
Comments are welcome.
Cheers.
--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***