[BACK]Return to decl.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / usr.bin / xlint / lint1

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/usr.bin/xlint/lint1/decl.c between version 1.205 and 1.206

version 1.205, 2021/07/15 23:42:49 version 1.206, 2021/07/15 23:47:00
Line 64  dinfo_t *dcs;
Line 64  dinfo_t *dcs;
   
 static  type_t  *tdeferr(type_t *, tspec_t);  static  type_t  *tdeferr(type_t *, tspec_t);
 static  void    settdsym(type_t *, sym_t *);  static  void    settdsym(type_t *, sym_t *);
 static  tspec_t merge_type_specifiers(tspec_t, tspec_t);  
 static  void    align(int, int);  static  void    align(int, int);
 static  sym_t   *newtag(sym_t *, scl_t, bool, bool);  static  sym_t   *newtag(sym_t *, scl_t, bool, bool);
 static  bool    eqargs(const type_t *, const type_t *, bool *);  static  bool    eqargs(const type_t *, const type_t *, bool *);
Line 382  add_type(type_t *tp)
Line 381  add_type(type_t *tp)
         }          }
 }  }
   
   /* Merge the signedness into the abstract type. */
   static tspec_t
   merge_signedness(tspec_t t, tspec_t s)
   {
   
           if (s != SIGNED && s != UNSIGN)
                   return t;
   
           if (t == CHAR)
                   return s == SIGNED ? SCHAR : UCHAR;
           if (t == SHORT)
                   return s == SIGNED ? SHORT : USHORT;
           if (t == INT)
                   return s == SIGNED ? INT : UINT;
           if (t == LONG)
                   return s == SIGNED ? LONG : ULONG;
           if (t == QUAD)
                   return s == SIGNED ? QUAD : UQUAD;
           return t;
   }
   
 /*  /*
  * called if a list of declaration specifiers contains a typedef name   * called if a list of declaration specifiers contains a typedef name
  * and other specifiers (except struct, union, enum, typedef name)   * and other specifiers (except struct, union, enum, typedef name)
Line 401  tdeferr(type_t *td, tspec_t t)
Line 421  tdeferr(type_t *td, tspec_t t)
                         if (!tflag)                          if (!tflag)
                                 /* modifying typedef with '%s'; only ... */                                  /* modifying typedef with '%s'; only ... */
                                 warning(5, ttab[t].tt_name);                                  warning(5, ttab[t].tt_name);
                         td = dup_type(gettyp(merge_type_specifiers(t2, t)));                          td = dup_type(gettyp(merge_signedness(t2, t)));
                         td->t_typedef = true;                          td->t_typedef = true;
                         return td;                          return td;
                 }                  }
Line 814  dcs_merge_declaration_specifiers(void)
Line 834  dcs_merge_declaration_specifiers(void)
         }          }
         if (l != NOTSPEC)          if (l != NOTSPEC)
                 t = l;                  t = l;
         dcs->d_type = gettyp(merge_type_specifiers(t, s));          dcs->d_type = gettyp(merge_signedness(t, s));
 }  }
   
 /*  /*
Line 859  end_type(void)
Line 879  end_type(void)
 }  }
   
 /*  /*
  * Merge type specifiers (char, ..., long long, signed, unsigned).  
  */  
 static tspec_t  
 merge_type_specifiers(tspec_t t, tspec_t s)  
 {  
   
         if (s != SIGNED && s != UNSIGN)  
                 return t;  
   
         if (t == CHAR)  
                 return s == SIGNED ? SCHAR : UCHAR;  
         if (t == SHORT)  
                 return s == SIGNED ? SHORT : USHORT;  
         if (t == INT)  
                 return s == SIGNED ? INT : UINT;  
         if (t == LONG)  
                 return s == SIGNED ? LONG : ULONG;  
         if (t == QUAD)  
                 return s == SIGNED ? QUAD : UQUAD;  
         return t;  
 }  
   
 /*  
  * Return the length of a type in bits.   * Return the length of a type in bits.
  *   *
  * Printing a message if the outermost dimension of an array is 0 must   * Printing a message if the outermost dimension of an array is 0 must

Legend:
Removed from v.1.205  
changed lines
  Added in v.1.206

CVSweb <webmaster@jp.NetBSD.org>