OSDN Git Service

* except.c (expand_start_all_catch): If the machine needs a
[pf3gnuchains/gcc-fork.git] / gcc / c-pragma.c
index e8324ca..886c67b 100644 (file)
@@ -15,20 +15,28 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
 
 #include <stdio.h>
 #include "config.h"
 #include "tree.h"
+#include "except.h"
+#include "function.h"
+#include "defaults.h"
+#include "c-pragma.h"
 
 #ifdef HANDLE_SYSV_PRAGMA
 
 /* When structure field packing is in effect, this variable is the
    number of bits to use as the maximum alignment.  When packing is not
-   in effect, this is zero. */
+   in effect, this is zero.  */
 
 extern int maximum_field_alignment;
 
+/* File used for outputting assembler code.  */
+extern FILE *asm_out_file;
+
 /* Handle one token of a pragma directive.  TOKEN is the
    current token, and STRING is its printable form.  */
 
@@ -37,20 +45,7 @@ handle_pragma_token (string, token)
      char *string;
      tree token;
 {
-  static enum pragma_state
-    {
-      ps_start,
-      ps_done,
-      ps_bad,
-      ps_weak,
-      ps_name,
-      ps_equals,
-      ps_value,
-      ps_pack,
-      ps_left,
-      ps_align,
-      ps_right
-      } state = ps_start, type;
+  static enum pragma_state state = ps_start, type;
   static char *name;
   static char *value;
   static int align;
@@ -64,27 +59,14 @@ handle_pragma_token (string, token)
          else
            warning ("malformed `#pragma pack'");
        }
-#ifdef WEAK_ASM_OP
       else if (type == ps_weak)
        {
-         if (state == ps_name || state == ps_value)
-           {
-             fprintf (asm_out_file, "\t%s\t", WEAK_ASM_OP);
-             ASM_OUTPUT_LABELREF (asm_out_file, name);
-             fputc ('\n', asm_out_file);
-             if (state == ps_value)
-               {
-                 fprintf (asm_out_file, "\t%s\t", SET_ASM_OP);
-                 ASM_OUTPUT_LABELREF (asm_out_file, name);
-                 fputc (',', asm_out_file);
-                 ASM_OUTPUT_LABELREF (asm_out_file, value);
-                 fputc ('\n', asm_out_file);
-               }
-           }
-         else if (! (state == ps_done || state == ps_start))
-           warning ("malformed `#pragma weak'");
+#ifdef HANDLE_PRAGMA_WEAK
+         if (HANDLE_PRAGMA_WEAK)
+           handle_pragma_weak (state, name, value);
+
+#endif /* HANDLE_PRAMA_WEAK */
        }
-#endif /* WEAK_ASM_OP */
 
       type = state = ps_start;
       return;
@@ -97,10 +79,8 @@ handle_pragma_token (string, token)
        {
          if (strcmp (IDENTIFIER_POINTER (token), "pack") == 0)
            type = state = ps_pack;
-#ifdef WEAK_ASM_OP
          else if (strcmp (IDENTIFIER_POINTER (token), "weak") == 0)
            type = state = ps_weak;
-#endif
          else
            type = state = ps_done;
        }
@@ -108,7 +88,6 @@ handle_pragma_token (string, token)
        type = state = ps_done;
       break;
 
-#ifdef WEAK_ASM_OP
     case ps_weak:
       if (token && TREE_CODE (token) == IDENTIFIER_NODE)
        {
@@ -136,7 +115,6 @@ handle_pragma_token (string, token)
     case ps_value:
       state = ps_bad;
       break;
-#endif /* WEAK_ASM_OP */
 
     case ps_pack:
       if (strcmp (string, "(") == 0)