Lines Matching refs:sym
415 set_first_typedef(type_t *tp, sym_t *sym)
420 tp->u.sou->sou_first_typedef = sym;
422 tp->u.enumer->en_first_typedef = sym;
900 check_type(sym_t *sym)
903 type_t **tpp = &sym->s_type;
913 !(to == NO_TSPEC && sym->s_osdef)) {
956 if (sym->s_scl != ABSTRACT) {
957 lint_assert(sym->s_name != unnamed);
959 error(61, sym->s_name);
964 } else if (sym->s_scl != TYPEDEF) {
966 error(19, sym->s_name);
1118 sym_t *mem = block_zero_alloc(sizeof(*mem), "sym");
1186 dsym = block_zero_alloc(sizeof(*dsym), "sym");
1350 for (sym_t *sym = dcs->d_first_dlsym;
1351 sym != NULL; sym = sym->s_level_next) {
1352 scl_t sc = sym->s_scl;
1355 warning(85, tag_name(sc), sym->s_name);
1464 check_function_definition(sym_t *sym, bool msg)
1467 if (sym->s_osdef) {
1471 sym->s_osdef = false;
1472 sym->u.s_old_style_params = NULL;
1478 declarator_name(sym_t *sym)
1482 if (sym->s_scl == NO_SCL)
1484 else if (sym->s_defparam) {
1485 sym->s_defparam = false;
1488 dcs->d_redeclared_symbol = sym;
1490 && sym->s_scl == STATIC && dcs->d_scl != STATIC) {
1492 query_message(16, sym->s_name);
1493 print_previous_declaration(sym);
1495 sym = pushdown(sym);
1501 sym->u.s_member.sm_containing_type = dcs->d_tag_type->u.sou;
1502 sym->s_def = DEF;
1515 sym->s_def = TDEF;
1517 sym->s_def = TDEF;
1519 sym->s_def = DEF;
1522 sym->s_def = DECL;
1526 sym->s_param = true;
1530 sym->s_register = dcs->d_scl == REG;
1532 sym->s_def = DEF;
1543 sym->s_def = DEF;
1546 sym->s_def = DEF;
1548 sym->s_register = true;
1550 sym->s_def = DEF;
1553 sym->s_def = DECL;
1561 sym->s_scl = sc;
1563 sym->s_type = dcs->d_type;
1565 sym->s_used = true;
1569 debug_sym("declarator_name: ", sym, "\n");
1571 return sym;
1575 old_style_function_parameter_name(sym_t *sym)
1578 if (sym->s_scl != NO_SCL) {
1579 if (block_level == sym->s_block_level) {
1581 error(21, sym->s_name);
1582 lint_assert(sym->s_defparam);
1584 sym = pushdown(sym);
1586 sym->s_type = gettyp(INT);
1587 sym->s_scl = AUTO;
1588 sym->s_def = DEF;
1589 sym->s_defparam = true;
1590 sym->s_param = true;
1591 debug_sym("old_style_function_parameter_name: ", sym, "\n");
1592 return sym;
1698 tag = block_zero_alloc(sizeof(*tag), "sym");
1788 enumeration_constant(sym_t *sym, int val, bool implicit)
1791 if (sym->s_scl != NO_SCL) {
1792 if (sym->s_block_level == block_level) {
1794 if (sym->s_param)
1796 warning(57, sym->s_name);
1799 error(27, sym->s_name);
1806 print_previous_declaration(sym);
1811 warning(43, sym->s_name);
1813 sym = pushdown(sym);
1816 sym->s_scl = ENUM_CONST;
1817 sym->s_type = dcs->d_tag_type;
1818 sym->u.s_enum_constant = val;
1822 warning(48, sym->s_name);
1825 debug_sym("enumeration_constant: ", sym, "\n");
1826 return sym;
1839 check_extern_declaration(const sym_t *sym)
1842 if (sym->s_scl == EXTERN &&
1846 !ch_isdigit(sym->s_name[0]) && /* see mktempsym */
1847 strcmp(sym->s_name, "main") != 0) {
1849 warning(351, sym->s_type->t_tspec == FUNC ? "" : " 'extern'",
1850 sym->s_name);
1852 if (sym->s_type->t_tspec == FUNC &&
1853 sym->s_scl == EXTERN &&
1854 sym->s_def == DECL &&
1857 query_message(13, sym->s_name);
1865 check_init(const sym_t *sym)
1868 if (sym->s_type->t_tspec == FUNC) {
1870 error(24, sym->s_name);
1873 if (sym->s_scl == TYPEDEF) {
1875 error(25, sym->s_name);
1878 if (sym->s_scl == EXTERN && sym->s_def == DECL) {
1881 warning(26, sym->s_name);
1884 error(26, sym->s_name);
2109 copy_usage_info(sym_t *sym, const sym_t *rdsym)
2112 sym->s_set_pos = rdsym->s_set_pos;
2113 sym->s_use_pos = rdsym->s_use_pos;
2114 sym->s_set = rdsym->s_set;
2115 sym->s_used = rdsym->s_used;
2361 declare_parameter(sym_t *sym, bool has_initializer)
2364 check_function_definition(sym, true);
2366 check_type(sym);
2371 error(237, sym->s_name);
2373 sym->s_param = true;
2376 if (!sym->s_param) {
2378 error(53, sym->s_name);
2379 sym->s_param = true;
2384 error(52, sym->s_name);
2386 if (sym->s_type == NULL) /* for c(void()) */
2387 sym->s_type = gettyp(VOID);
2389 tspec_t t = sym->s_type->t_tspec;
2391 type_t *subt = block_dup_type(sym->s_type->t_subt);
2392 if (sym->s_type->t_const)
2394 if (sym->s_type->t_volatile)
2396 sym->s_type = block_derive_type(subt, PTR);
2401 warning(50, sym->s_name);
2402 sym->s_type = block_derive_type(sym->s_type, PTR);
2405 sym->s_type = gettyp(DOUBLE);
2409 warning(269, sym->s_name);
2411 if (sym->s_type->t_const
2412 && (sym->s_scl == AUTO || sym->s_scl == REG)) {
2414 query_message(18, sym->s_name);
2422 if (sym->s_type->t_tspec != VOID)
2423 (void)length_in_bits(sym->s_type, sym->s_name);
2425 sym->s_used = dcs->d_used;
2426 mark_as_set(sym);
2429 debug_sym("", sym, "\n");
2430 return sym;
2808 sym_t *sym = block_zero_alloc(sizeof(*sym), "sym");
2809 sym->s_name = unnamed;
2810 sym->s_def = DEF;
2811 sym->s_scl = ABSTRACT;
2812 sym->s_block_level = -1;
2813 sym->s_param = dcs->d_kind == DLK_PROTO_PARAMS;
2820 sym->s_type = enclosing ? dcs->d_enclosing->d_type : dcs->d_type;
2824 debug_sym("", sym, "\n");
2826 return sym;
2857 declare_abstract_type(sym_t *sym)
2860 check_function_definition(sym, true);
2861 check_type(sym);
2862 return sym;
2887 mark_as_set(sym_t *sym)
2890 if (!sym->s_set) {
2891 sym->s_set = true;
2892 sym->s_set_pos = unique_curr_pos();
2898 mark_as_used(sym_t *sym, bool fcall, bool szof)
2901 if (!sym->s_used) {
2902 sym->s_used = true;
2903 sym->s_use_pos = unique_curr_pos();
2912 if (!fcall && !szof && sym->s_kind == SK_VCFT && sym->s_scl == EXTERN)
2913 outusg(sym);
2925 for (sym_t *sym = dl->d_first_dlsym;
2926 sym != NULL; sym = sym->s_level_next)
2927 check_usage_sym(dl->d_asm, sym);
2947 check_variable_usage(bool novar, const sym_t *sym)
2953 if (sym->s_block_level == 0 && ch_isdigit(sym->s_name[0]))
2964 scl_t sc = sym->s_scl;
2972 if (!sym->s_used && !sym->s_set) {
2974 warning_at(192, &sym->s_def_pos,
2975 sym->s_name, funcsym->s_name);
2978 if (sym->s_set && !sym->s_used) {
2980 warning_at(191, &sym->s_set_pos,
2981 sym->s_name, funcsym->s_name);
2982 } else if (!sym->s_used) {
2984 warning_at(192, &sym->s_def_pos,
2985 sym->s_name, funcsym->s_name);
3000 sym_t *xsym = sym->s_ext_sym;
3002 if (sym->s_used && !xsym->s_used) {
3004 xsym->s_use_pos = sym->s_use_pos;
3006 if (sym->s_set && !xsym->s_set) {
3008 xsym->s_set_pos = sym->s_set_pos;
3033 check_tag_usage(const sym_t *sym)
3036 if (!is_incomplete(sym->s_type))
3043 switch (sym->s_type->t_tspec) {
3046 warning_at(233, &sym->s_def_pos, sym->s_name);
3050 warning_at(234, &sym->s_def_pos, sym->s_name);
3053 lint_assert(sym->s_type->t_tspec == ENUM);
3055 warning_at(235, &sym->s_def_pos, sym->s_name);
3062 check_usage_sym(bool novar, const sym_t *sym)
3065 if (sym->s_block_level == -1)
3068 if (sym->s_kind == SK_VCFT && sym->s_param)
3069 check_parameter_usage(novar, sym);
3070 else if (sym->s_kind == SK_VCFT)
3071 check_variable_usage(novar, sym);
3072 else if (sym->s_kind == SK_LABEL)
3073 check_label_usage(sym);
3074 else if (sym->s_kind == SK_TAG)
3075 check_tag_usage(sym);
3079 check_global_variable_size(const sym_t *sym)
3082 if (sym->s_def != TDEF)
3084 if (sym->s_type->t_tspec == FUNC)
3087 if (sym->s_def == TDEF && sym->s_type->t_tspec == VOID)
3092 curr_pos = sym->s_def_pos;
3093 int len_in_bits = length_in_bits(sym->s_type, sym->s_name);
3097 sym->s_type->t_tspec == ARRAY && sym->s_type->u.dimension == 0) {
3100 (sym->s_scl == EXTERN && (allow_trad || allow_c99))) {
3102 warning_at(190, &sym->s_def_pos, sym->s_name);
3105 error_at(190, &sym->s_def_pos, sym->s_name);
3111 check_unused_static_global_variable(const sym_t *sym)
3113 if (sym->s_type->t_tspec == FUNC) {
3114 if (sym->s_def == DEF) {
3115 if (!sym->s_inline)
3117 warning_at(236, &sym->s_def_pos, sym->s_name);
3120 warning_at(290, &sym->s_def_pos, sym->s_name);
3121 } else if (!sym->s_set)
3123 warning_at(226, &sym->s_def_pos, sym->s_name);
3126 warning_at(307, &sym->s_def_pos, sym->s_name);
3130 check_static_global_variable(const sym_t *sym)
3132 if (sym->s_type->t_tspec == FUNC && sym->s_used && sym->s_def != DEF)
3134 error_at(225, &sym->s_use_pos, sym->s_name);
3136 if (!sym->s_used)
3137 check_unused_static_global_variable(sym);
3139 if (allow_c90 && sym->s_def == TDEF && sym->s_type->t_const)
3141 warning_at(227, &sym->s_def_pos, sym->s_name);
3145 check_global_variable(const sym_t *sym)
3147 scl_t scl = sym->s_scl;
3157 check_global_variable_size(sym);
3160 check_static_global_variable(sym);
3170 for (const sym_t *sym = dcs->d_first_dlsym;
3171 sym != NULL; sym = sym->s_level_next) {
3172 if (sym->s_block_level == -1)
3174 if (sym->s_kind == SK_VCFT)
3175 check_global_variable(sym);
3176 else if (sym->s_kind == SK_TAG)
3177 check_tag_usage(sym);
3179 lint_assert(sym->s_kind == SK_MEMBER);