a few more warnings
[suif.git] / src / basesuif / fixfortran / constants.cc
blobaf7d7b2b46f8ab6fca37d209f20a50cb7072e21f
1 /* file "constants.cc" of the fixfortran program for SUIF */
3 /* Copyright (c) 1996 Stanford University
5 All rights reserved.
7 This software is provided under the terms described in
8 the "suif_copyright.h" include file. */
10 #include <suif_copyright.h>
13 * This file contains code to mark globals that have been created by
14 * sf2c exclusively to store constant integer or floating-point
15 * values with ``constant'' annotations, so other passes know the
16 * values of these variables cannot change, so the constant
17 * initialization data can be used anywhere the variable is used.
20 #define RCS_BASE_FILE constants_cc
22 #include "fixfortran.h"
23 #include <ctype.h>
25 RCS_BASE(
26 "$Id: constants.cc,v 1.1.1.1 1998/06/16 15:17:22 brm Exp $")
28 /*----------------------------------------------------------------------*
29 Begin Type Declarations
30 *----------------------------------------------------------------------*/
32 /*----------------------------------------------------------------------*
33 End Type Declarations
34 *----------------------------------------------------------------------*/
35 /*----------------------------------------------------------------------*
36 Begin Private Function Declarations
37 *----------------------------------------------------------------------*/
39 /*----------------------------------------------------------------------*
40 End Private Function Declarations
41 *----------------------------------------------------------------------*/
42 /*----------------------------------------------------------------------*
43 Begin Public Function Implementations
44 *----------------------------------------------------------------------*/
46 extern void mark_constants(file_symtab *the_symtab)
48 sym_node_list_iter sym_iter(the_symtab->symbols());
49 while (!sym_iter.is_empty())
51 sym_node *this_sym = sym_iter.step();
52 if (!this_sym->is_var())
53 continue;
54 var_sym *this_var = (var_sym *)this_sym;
55 type_node *this_type = this_var->type()->unqual();
56 type_ops this_type_op = this_type->op();
57 if ((this_type_op != TYPE_INT) && (this_type_op != TYPE_FLOAT))
58 continue;
59 const char *this_name = this_var->name();
60 if ((this_name[0] != 'c') || (this_name[1] != '_') ||
61 (this_name[2] != '_'))
63 continue;
65 char *follow = &(this_name[3]);
66 if (!isdigit(*follow))
67 continue;
70 ++follow;
71 } while (isdigit(*follow));
72 if (*follow != 0)
73 continue;
74 this_var->append_annote(k_is_constant);
78 /*----------------------------------------------------------------------*
79 End Public Function Implementations
80 *----------------------------------------------------------------------*/
81 /*----------------------------------------------------------------------*
82 Begin Private Function Implementations
83 *----------------------------------------------------------------------*/
85 /*----------------------------------------------------------------------*
86 End Private Function Implementations
87 *----------------------------------------------------------------------*/