This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Feature request PR14331: add -W(no-)eof-newline



    Hi gcc-patches@,

:ADDPATCH cpp:

ref: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14331

  Here's the patch as promised that implements the new warning option to
suppress the "No newline at end of file" warning message.  It's modelled on
the -Wendif-labels option, in particular the fact that -pedantic enables it
even if it's been turned off by an earlier option (and that a later option can
disable it again).

  It comes with documentation and testcases.  Bootstrapped and regtested on
x86_64-unknown-linux-gnu in C,C++ and Fortran, with no regressions, and
bootstrapped and tested for correctness on i686-pc-cygwin in C,C++ and
Fortran.

  Ok to checkin?


gcc/ChangeLog

2007-04-10  Dave Korn  <dave.korn@artimi.com>

	* doc/cppopts.texi: Document -Weof-newline.
	* doc/invoke.texi: Document -Wno-eof-newline.
	* c.opt: Add Weof-newline.
	* c-opts.c (c_common_handle_option):  Handle OPT_Weof_newline.

gcc/testsuite/ChangeLog

2007-04-10  Dave Korn  <dave.korn@artimi.com>

	* gcc.dg/cpp/Wno-eof-newline.c, gcc.dg/cpp/Wno-eof-newline-2.c,
	gcc.dg/cpp/Wno-eof-newline.h, gcc.dg/cpp/Wno-eof-newline.c,
	gcc.dg/cpp/Wno-eof-newline-2.c, gcc.dg/cpp/Wno-eof-newline.h: New
	testcases for new warning flag.

libcpp/ChangeLog

2007-04-10  Dave Korn  <dave.korn@artimi.com>

	* libcpp/include/cpplib.h (struct cpp_options): Add new struct
	member warn_eof_newline.
	* libcpp/init.c (cpp_create_reader): Default warn_eof_newline on.
	* libcpp/lex.c (_cpp_get_fresh_line): Suppress "no newline at end
	of file" warning if warn_eof_newline not set in reader options.



    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

Attachment: Weof-newline-patch.final.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]