+2009-04-20 Eric Botcazou <ebotcazou@adacore.com>
+
+ * adaint.h (__gnat_lwp_self): Declare on Linux.
+
+ * adaint.c (__gnat_os_filename): Add ATTRIBUTE_UNUSED on 'filename'.
+
+2009-04-20 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch5.adb, usage.adb, back_end.adb, opt.ads: Implement
+ front-end part of -fpreserve-control-flow switch.
+
2009-04-20 Bob Duff <duff@adacore.com>
* rtsfind.adb: Minor comment fix
/* Returns the OS filename and corresponding encoding. */
void
-__gnat_os_filename (char *filename, char *w_filename ATTRIBUTE_UNUSED,
+__gnat_os_filename (char *filename ATTRIBUTE_UNUSED,
+ char *w_filename ATTRIBUTE_UNUSED,
char *os_name, int *o_length,
char *encoding ATTRIBUTE_UNUSED, int *e_length)
{
thread. We need to do a system call in order to retrieve this
information. */
#include <sys/syscall.h>
-void *__gnat_lwp_self (void) {
+void *__gnat_lwp_self (void)
+{
return (void *) syscall (__NR_gettid);
}
#endif
extern void __gnat_os_filename (char *, char *, char *,
int *, char *, int *);
+#if defined (linux)
+extern void *__gnat_lwp_self (void);
+#endif
#if defined (__MINGW32__) && !defined (RTX)
extern void __gnat_plist_init (void);
if Switch_Chars (First .. Last) = "fno-inline" then
Opt.Suppress_All_Inlining := True;
+
+ -- Another special check, the switch -fpreserve-control-flow
+ -- which is also a back end switch sets the front end flag
+ -- that inhibits improper control flow transformations.
+
+ elsif Switch_Chars (First .. Last) = "fpreserve-control-flow" then
+ Opt.Suppress_Control_Flow_Optimizations := True;
end if;
end if;
end Scan_Back_End_Switches;
-- return not (expression);
- -- Only do these optimizations if we are at least at -O1 level
+ -- Only do these optimizations if we are at least at -O1 level and
+ -- do not do them if control flow optimizations are suppressed.
- if Optimization_Level > 0 then
+ if Optimization_Level > 0
+ and then not Opt.Suppress_Control_Flow_Optimizations
+ then
if Nkind (N) = N_If_Statement
and then No (Elsif_Parts (N))
and then Present (Else_Statements (N))
-- Set by -fno-inline. Suppresses all inlining, both front end and back end
-- regardless of any other switches that are set.
+ Suppress_Control_Flow_Optimizations : Boolean := False;
+ -- GNAT
+ -- Set by -fpreserve-control-flow. Suppresses control flow optimizations
+ -- that interfere with coverage analysis based on the object code.
+
System_Extend_Pragma_Arg : Node_Id := Empty;
-- GNAT
-- Set non-empty if and only if a correct Extend_System pragma was present
Write_Switch_Char ("fno-inline ", "");
Write_Line ("Inhibit all inlining (makes executable smaller)");
+
+ Write_Switch_Char ("fpreserve-control-flow ", "");
+ Write_Line ("Preserve control flow for coverage analysis");
end if;
-- Common switches available to both GCC and JGNAT