+2008-08-05 Robert Dewar <dewar@adacore.com>
+
+ * opt.ads (Warn_On_Biased_Representation): New flag
+
+ * sem_ch13.adb:
+ (Analyze_Attribute_Definition_Clause): Issue warning when biased
+ representation is required.
+ (Minimum_Size): Don't allow biasing if enum rep clause case
+
+ * sem_warn.adb:
+ (Set_Dot_Warning_Switch): Add handling of -gnatw.b/B switches
+ (Set_Warning_Switch): Include -gnatw.b in -gnatwa, -gnatw.B in gnatws
+
+ * usage.adb: Add lines for -gnatw.b/B switches
+
+2008-08-05 Pascal Obry <obry@adacore.com>
+
+ * a-coinve.adb: Reorder the code to avoid uninitialized warning.
+
+ * adaint.c: In UNIX cases do not call __gnat_stat but stat directly.
+
+2008-08-05 Thomas Quinot <quinot@adacore.com>
+
+ * socket.c: Minor reformatting.
+
2008-08-05 Robert Dewar <dewar@adacore.com>
* sem_ch3.adb: Minor reformatting
-- Set to True to generate warnings for static fixed-point expression
-- values that are not an exact multiple of the small value of the type.
+ Warn_On_Biased_Representation : Boolean := True;
+ -- GNAT
+ -- Set to True to generate warnings for size clauses, component clauses
+ -- and component_size clauses that force biased representation. Set False
+ -- by -gnatw.B.
+
Warn_On_Constant : Boolean := False;
-- GNAT
-- Set to True to generate warnings for variables that could be declared
Set_Associated_Node_For_Itype (New_Ctyp, U_Ent);
Set_Component_Type (Btype, New_Ctyp);
+
+ if Warn_On_Biased_Representation then
+ Error_Msg_N
+ ("?component size clause forces biased "
+ & "representation", N);
+ end if;
end if;
Set_Component_Size (Btype, Csize);
or else Has_Small_Clause (U_Ent)
then
Check_Size (Expr, Etyp, Size, Biased);
- Set_Has_Biased_Representation (U_Ent, Biased);
+ Set_Has_Biased_Representation (U_Ent, Biased);
+
+ if Biased and Warn_On_Biased_Representation then
+ Error_Msg_N
+ ("?size clause forces biased representation", N);
+ end if;
end if;
-- For types set RM_Size and Esize if possible
if Is_Elementary_Type (U_Ent) then
Check_Size (Expr, U_Ent, Size, Biased);
Set_Has_Biased_Representation (U_Ent, Biased);
+
+ if Biased and Warn_On_Biased_Representation then
+ Error_Msg_N
+ ("?value size clause forces biased representation", N);
+ end if;
end if;
Set_RM_Size (U_Ent, Size);
Set_Has_Biased_Representation (Comp, Biased);
+ if Biased and Warn_On_Biased_Representation then
+ Error_Msg_F
+ ("?component clause forces biased "
+ & "representation", CC);
+ end if;
+
if Present (Ocomp) then
Set_Component_Clause (Ocomp, CC);
Set_Component_Bit_Offset (Ocomp, Fbit);
-- Fall through with Hi and Lo set. Deal with biased case
- if (Biased and then not Is_Fixed_Point_Type (T))
+ if (Biased
+ and then not Is_Fixed_Point_Type (T)
+ and then not (Is_Enumeration_Type (T)
+ and then Has_Non_Standard_Rep (T)))
or else Has_Biased_Representation (T)
then
Hi := Hi - Lo;
when 'A' =>
Warn_On_Assertion_Failure := False;
+ when 'b' =>
+ Warn_On_Biased_Representation := True;
+
+ when 'B' =>
+ Warn_On_Biased_Representation := False;
+
when 'c' =>
Warn_On_Unrepped_Components := True;
Warn_On_Assertion_Failure := True;
Warn_On_Assumed_Low_Bound := True;
Warn_On_Bad_Fixed_Value := True;
+ Warn_On_Biased_Representation := True;
Warn_On_Constant := True;
Warn_On_Deleted_Code := True;
Warn_On_Dereference := True;
Warn_On_Export_Import := True;
Warn_On_Hiding := True;
- Ineffective_Inline_Warnings := True;
Warn_On_Modified_Unread := True;
Warn_On_No_Value_Assigned := True;
Warn_On_Non_Local_Exception := True;
Warn_On_Assertion_Failure := True;
Warn_On_Assumed_Low_Bound := True;
Warn_On_Bad_Fixed_Value := True;
+ Warn_On_Biased_Representation := True;
Warn_On_Constant := True;
Warn_On_Export_Import := True;
Warn_On_Modified_Unread := True;
Warn_On_Assertion_Failure := False;
Warn_On_Assumed_Low_Bound := False;
Warn_On_Bad_Fixed_Value := False;
+ Warn_On_Biased_Representation := False;
Warn_On_Constant := False;
Warn_On_Deleted_Code := False;
Warn_On_Dereference := False;
Write_Line (" a turn on all optional warnings " &
"(except dhl.ot.w)");
Write_Line (" A turn off all optional warnings");
- Write_Line (" .a* turn on warnings for failing assertions");
- Write_Line (" .A turn off warnings for failing assertions");
+ Write_Line (" .a* turn on warnings for failing assertion");
+ Write_Line (" .A turn off warnings for failing assertion");
Write_Line (" b turn on warnings for bad fixed value " &
"(not multiple of small)");
Write_Line (" B* turn off warnings for bad fixed value " &
"(not multiple of small)");
+ Write_Line (" .b* turn on warnings for biased representation");
+ Write_Line (" .B turn off warnings for biased representation");
Write_Line (" c turn on warnings for constant conditional");
Write_Line (" C* turn off warnings for constant conditional");
Write_Line (" .c turn on warnings for unrepped components");
Write_Line (" F* turn off warnings for unreferenced formal");
Write_Line (" g* turn on warnings for unrecognized pragma");
Write_Line (" G turn off warnings for unrecognized pragma");
- Write_Line (" h turn on warnings for hiding variable ");
+ Write_Line (" h turn on warnings for hiding variable");
Write_Line (" H* turn off warnings for hiding variable");
Write_Line (" i* turn on warnings for implementation unit");
Write_Line (" I turn off warnings for implementation unit");
Write_Line (" .P* turn off warnings for suspicious parameter " &
"order");
Write_Line (" q* turn on warnings for questionable " &
- "missing parentheses");
+ "missing parenthesis");
Write_Line (" Q turn off warnings for questionable " &
- "missing parentheses");
+ "missing parenthesis");
Write_Line (" r turn on warnings for redundant construct");
Write_Line (" R* turn off warnings for redundant construct");
Write_Line (" .r turn on warnings for object renaming function");
Write_Line (" .w* turn off warnings on pragma Warnings Off");
Write_Line (" x* turn on warnings for export/import");
Write_Line (" X turn off warnings for export/import");
- Write_Line (" .x turn on warnings for non-local exceptions");
- Write_Line (" .X* turn off warnings for non-local exceptions");
+ Write_Line (" .x turn on warnings for non-local exception");
+ Write_Line (" .X* turn off warnings for non-local exception");
Write_Line (" y* turn on warnings for Ada 2005 incompatibility");
Write_Line (" Y turn off warnings for Ada 2005 incompatibility");
Write_Line (" z* turn on warnings for convention/size/align " &