diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-05-06 14:43:39 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-05-06 14:43:39 +0200 |
commit | 35117aa8a959b64c128715b6142a6ab45efb9169 (patch) | |
tree | f3bf018f81dee2549add1a7bdde000898d559e9c /gcc | |
parent | 0c020ddef1f2574c03e6d49497e8b73d55824e22 (diff) | |
download | gcc-35117aa8a959b64c128715b6142a6ab45efb9169.zip gcc-35117aa8a959b64c128715b6142a6ab45efb9169.tar.gz gcc-35117aa8a959b64c128715b6142a6ab45efb9169.tar.bz2 |
[multiple changes]
2009-05-06 Sergey Rybin <rybin@adacore.com>
* gnat_ugn.texi: Add subsection for Exits_From_Conditional_Loops rule
Add formal definition for extra exit point metric
2009-05-06 Pascal Obry <obry@adacore.com>
* adaint.c: Support for setting attributes on unicode filename on
Windows.
From-SVN: r147171
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/ada/adaint.c | 57 | ||||
-rw-r--r-- | gcc/ada/gnat_ugn.texi | 30 |
3 files changed, 96 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 0256492..0a77a74 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,13 @@ +2009-05-06 Sergey Rybin <rybin@adacore.com> + + * gnat_ugn.texi: Add subsection for Exits_From_Conditional_Loops rule + Add formal definition for extra exit point metric + +2009-05-06 Pascal Obry <obry@adacore.com> + + * adaint.c: Support for setting attributes on unicode filename on + Windows. + 2009-05-06 Robert Dewar <dewar@adacore.com> * sem_warn.adb: Minor reformatting diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index 83da18b..1f5e154 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -3369,6 +3369,63 @@ __gnat_copy_attribs (char *from, char *to, int mode) { #if defined (VMS) || defined (__vxworks) || defined (__nucleus__) return -1; + +#elif defined (_WIN32) && !defined (RTX) + TCHAR wfrom [GNAT_MAX_PATH_LEN + 2]; + TCHAR wto [GNAT_MAX_PATH_LEN + 2]; + BOOL res; + FILETIME fct, flat, flwt; + HANDLE hfrom, hto; + + S2WSC (wfrom, from, GNAT_MAX_PATH_LEN + 2); + S2WSC (wto, to, GNAT_MAX_PATH_LEN + 2); + + /* retrieve from times */ + + hfrom = CreateFile + (wfrom, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + + if (hfrom == INVALID_HANDLE_VALUE) + return -1; + + res = GetFileTime (hfrom, &fct, &flat, &flwt); + + CloseHandle (hfrom); + + if (res == 0) + return -1; + + /* retrieve from times */ + + hto = CreateFile + (wto, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + + if (hto == INVALID_HANDLE_VALUE) + return -1; + + res = SetFileTime (hto, NULL, &flat, &flwt); + + CloseHandle (hto); + + if (res == 0) + return -1; + + /* Set file attributes in full mode. */ + + if (mode == 1) + { + DWORD attribs = GetFileAttributes (wfrom); + + if (attribs == INVALID_FILE_ATTRIBUTES) + return -1; + + res = SetFileAttributes (wto, attribs); + if (res == 0) + return -1; + } + + return 0; + #else struct stat fbuf; struct utimbuf tbuf; diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index e035ec6..4a59e16 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -17637,7 +17637,11 @@ Do not consider @code{exit} statements as @code{goto}s when computing Essential Complexity @item ^--extra-exit-points^/EXTRA_EXIT_POINTS_ON^ -Report the extra exit points for subprogram bodies +Report the extra exit points for subprogram bodies. As an exit point, this +metric counts @code{return} statements and raise statements in case when the +raised exception is not handled in the same body. In case of a function this +metric subtracts 1 from the number of exit points, because a function body +must contain at least one @code{return} statement. @item ^--no-extra-exit-points^/EXTRA_EXIT_POINTS_OFF^ Do not report the extra exit points for subprogram bodies @@ -20889,6 +20893,7 @@ used as a parameter of the @option{+R} or @option{-R} options. * Discriminated_Records:: * Enumeration_Ranges_In_CASE_Statements:: * Exceptions_As_Control_Flow:: +* Exits_From_Conditional_Loops:: * EXIT_Statements_With_No_Loop_Name:: * Expanded_Loop_Exit_Names:: * Explicit_Full_Discrete_Ranges:: @@ -20939,6 +20944,7 @@ used as a parameter of the @option{+R} or @option{-R} options. * Slices:: * Unassigned_OUT_Parameters:: * Uncommented_BEGIN_In_Package_Bodies:: +* Unconditional_Exits:: * Unconstrained_Array_Returns:: * Universal_Ranges:: * Unnamed_Blocks_And_Loops:: @@ -21155,6 +21161,20 @@ package body, task body or entry body is not flagged. The rule has no parameters. +@node Exits_From_Conditional_Loops +@subsection @code{Exits_From_Conditional_Loops} +@cindex @code{Exits_From_Conditional_Loops} (for @command{gnatcheck}) + +@noindent +Flag any exit statement if it transfers the control out of a @code{for} loop +or a @code{while} loop. This includes cases when the @code{exit} statement +applies to a @code{FOR} or @code{while} loop, and cases when it is enclosed +in some @code{for} or @code{while} loop, but transfers the control from some +outer (inconditional) @code{loop} statement. + +The rule has no parameters. + + @node EXIT_Statements_With_No_Loop_Name @subsection @code{EXIT_Statements_With_No_Loop_Name} @cindex @code{EXIT_Statements_With_No_Loop_Name} (for @command{gnatcheck}) @@ -22253,6 +22273,14 @@ diagnostic message is attached to the line containing the first statement. This rule has no parameters. +@node Unconditional_Exits +@subsection @code{Unconditional_Exits} +@cindex @code{Unconditional_Exits} rule (for @command{gnatcheck}) + +@noindent +Flag unconditional @code{exit} statements. + +This rule has no parameters. @node Unconstrained_Array_Returns @subsection @code{Unconstrained_Array_Returns} |