Module Name: src Committed By: christos Date: Thu Dec 29 16:41:16 UTC 2016
Modified Files: src/usr.bin/xlint/lint1: cgram.y scan.l Log Message: Add more attributes. To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.84 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.68 -r1.69 src/usr.bin/xlint/lint1/scan.l Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.83 src/usr.bin/xlint/lint1/cgram.y:1.84 --- src/usr.bin/xlint/lint1/cgram.y:1.83 Thu Dec 29 11:01:46 2016 +++ src/usr.bin/xlint/lint1/cgram.y Thu Dec 29 11:41:16 2016 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.83 2016/12/29 16:01:46 christos Exp $ */ +/* $NetBSD: cgram.y,v 1.84 2016/12/29 16:41:16 christos Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: cgram.y,v 1.83 2016/12/29 16:01:46 christos Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.84 2016/12/29 16:41:16 christos Exp $"); #endif #include <stdlib.h> @@ -199,25 +199,31 @@ anonymize(sym_t *s) /* Type Attributes */ %token <y_type> T_ATTRIBUTE %token <y_type> T_AT_ALIGNED +%token <y_type> T_AT_COLD +%token <y_type> T_AT_CONSTRUCTOR %token <y_type> T_AT_DEPRECATED -%token <y_type> T_AT_NORETURN +%token <y_type> T_AT_FORMAT +%token <y_type> T_AT_FORMAT_ARG +%token <y_type> T_AT_FORMAT_PRINTF +%token <y_type> T_AT_FORMAT_SCANF +%token <y_type> T_AT_FORMAT_STRFTIME +%token <y_type> T_AT_FORMAT_STRFMON %token <y_type> T_AT_GNU_INLINE %token <y_type> T_AT_MAY_ALIAS +%token <y_type> T_AT_MODE +%token <y_type> T_AT_NORETURN +%token <y_type> T_AT_NO_INSTRUMENT_FUNCTION %token <y_type> T_AT_PACKED %token <y_type> T_AT_PURE +%token <y_type> T_AT_RETURNS_TWICE +%token <y_type> T_AT_SECTION +%token <y_type> T_AT_SENTINEL %token <y_type> T_AT_TUINION %token <y_type> T_AT_TUNION %token <y_type> T_AT_UNUSED -%token <y_type> T_AT_WEAK +%token <y_type> T_AT_USED %token <y_type> T_AT_VISIBILITY -%token <y_type> T_AT_FORMAT -%token <y_type> T_AT_FORMAT_PRINTF -%token <y_type> T_AT_FORMAT_SCANF -%token <y_type> T_AT_FORMAT_STRFTIME -%token <y_type> T_AT_FORMAT_ARG -%token <y_type> T_AT_SENTINEL -%token <y_type> T_AT_RETURNS_TWICE -%token <y_type> T_AT_COLD +%token <y_type> T_AT_WEAK %left T_COMMA %right T_ASSIGN T_OPASS @@ -496,6 +502,7 @@ declaration: type_attribute_format_type: T_AT_FORMAT_PRINTF | T_AT_FORMAT_SCANF + | T_AT_FORMAT_STRFMON | T_AT_FORMAT_STRFTIME ; @@ -504,8 +511,12 @@ type_attribute_spec: | T_AT_ALIGNED T_LPARN constant T_RPARN | T_AT_SENTINEL T_LPARN constant T_RPARN | T_AT_FORMAT_ARG T_LPARN constant T_RPARN + | T_AT_MODE T_LPARN T_NAME T_RPARN + | T_AT_SECTION T_LPARN string T_RPARN | T_AT_ALIGNED + | T_AT_CONSTRUCTOR | T_AT_MAY_ALIAS + | T_AT_NO_INSTRUMENT_FUNCTION | T_AT_NORETURN | T_AT_COLD | T_AT_RETURNS_TWICE @@ -517,6 +528,9 @@ type_attribute_spec: | T_AT_GNU_INLINE | T_AT_FORMAT T_LPARN type_attribute_format_type T_COMMA constant T_COMMA constant T_RPARN + | T_AT_USED { + addused(); + } | T_AT_UNUSED { addused(); } @@ -528,10 +542,15 @@ type_attribute_spec: } ; +type_attribute_spec_list: + type_attribute_spec + | type_attribute_spec_list T_COMMA type_attribute_spec + ; + type_attribute: T_ATTRIBUTE T_LPARN T_LPARN { attron = 1; - } type_attribute_spec { + } type_attribute_spec_list { attron = 0; } T_RPARN T_RPARN | T_PACKED { Index: src/usr.bin/xlint/lint1/scan.l diff -u src/usr.bin/xlint/lint1/scan.l:1.68 src/usr.bin/xlint/lint1/scan.l:1.69 --- src/usr.bin/xlint/lint1/scan.l:1.68 Sat Dec 24 12:43:45 2016 +++ src/usr.bin/xlint/lint1/scan.l Thu Dec 29 11:41:16 2016 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: scan.l,v 1.68 2016/12/24 17:43:45 christos Exp $ */ +/* $NetBSD: scan.l,v 1.69 2016/12/29 16:41:16 christos Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: scan.l,v 1.68 2016/12/24 17:43:45 christos Exp $"); +__RCSID("$NetBSD: scan.l,v 1.69 2016/12/29 16:41:16 christos Exp $"); #endif #include <stdlib.h> @@ -215,8 +215,12 @@ static struct kwtab { { "transparent_union",T_AT_TUNION,0, 0, 0, 0, 0, 1, 1 }, { "__unused__", T_AT_UNUSED, 0, 0, 0, 0, 0, 1, 1 }, { "unused", T_AT_UNUSED, 0, 0, 0, 0, 0, 1, 1 }, + { "__used__", T_AT_USED, 0, 0, 0, 0, 0, 1, 1 }, + { "used", T_AT_USED, 0, 0, 0, 0, 0, 1, 1 }, { "__gnu_inline__",T_AT_GNU_INLINE,0, 0, 0, 0, 0, 1, 1 }, { "gnu_inline", T_AT_GNU_INLINE,0, 0, 0, 0, 0, 1, 1 }, + { "__constructor__",T_AT_CONSTRUCTOR,0, 0, 0, 0, 0, 1, 1 }, + { "constructor",T_AT_CONSTRUCTOR,0, 0, 0, 0, 0, 1, 1 }, { "__deprecated__",T_AT_DEPRECATED,0, 0, 0, 0, 0, 1, 1 }, { "deprecated", T_AT_DEPRECATED,0, 0, 0, 0, 0, 1, 1 }, { "__may_alias__",T_AT_MAY_ALIAS,0, 0, 0, 0, 0, 1, 1 }, @@ -227,12 +231,20 @@ static struct kwtab { { "__printf__", T_AT_FORMAT_PRINTF,0, 0, 0, 0, 0, 1, 1 }, { "scanf", T_AT_FORMAT_SCANF,0, 0, 0, 0, 0, 1, 1 }, { "__scanf__", T_AT_FORMAT_SCANF,0, 0, 0, 0, 0, 1, 1 }, - { "strftime", T_AT_FORMAT_SCANF,0, 0, 0, 0, 0, 1, 1 }, + { "strfmon", T_AT_FORMAT_STRFMON,0, 0, 0, 0, 0, 1, 1 }, + { "__strfmon__",T_AT_FORMAT_STRFMON,0, 0, 0, 0, 0, 1, 1 }, + { "strftime", T_AT_FORMAT_STRFTIME,0, 0, 0, 0, 0, 1, 1 }, { "__strftime__",T_AT_FORMAT_STRFTIME,0,0, 0, 0, 0, 1, 1 }, { "pure", T_AT_PURE, 0, 0, 0, 0, 0, 1, 1 }, { "__pure__", T_AT_PURE, 0, 0, 0, 0, 0, 1, 1 }, { "noreturn", T_AT_NORETURN, 0, 0, 0, 0, 0, 1, 1 }, { "__noreturn__",T_AT_NORETURN, 0, 0, 0, 0, 0, 1, 1 }, + { "no_instrument_function", T_AT_NO_INSTRUMENT_FUNCTION, + 0, 0, 0, 0, 0, 1, 1 }, + { "__no_instrument_function", T_AT_NO_INSTRUMENT_FUNCTION, + 0, 0, 0, 0, 0, 1, 1 }, + { "__no_instrument_function__", T_AT_NO_INSTRUMENT_FUNCTION, + 0, 0, 0, 0, 0, 1, 1 }, { "sentinel", T_AT_SENTINEL, 0, 0, 0, 0, 0, 1, 1 }, { "__sentinel__",T_AT_SENTINEL, 0, 0, 0, 0, 0, 1, 1 }, { "format_arg", T_AT_FORMAT_ARG,0, 0, 0, 0, 0, 1, 1 }, @@ -273,12 +285,18 @@ static struct kwtab { { "int", T_TYPE, 0, INT, 0, 0, 0, 0, 0 }, { "__symbolrename", T_SYMBOLRENAME, 0, 0, 0, 0, 0, 0, 0 }, { "long", T_TYPE, 0, LONG, 0, 0, 0, 0, 0 }, + { "mode", T_AT_MODE, 0, 0, 0, 0, 0, 1, 1 }, + { "__mode", T_AT_MODE, 0, 0, 0, 0, 0, 1, 1 }, + { "__mode__", T_AT_MODE, 0, 0, 0, 0, 0, 1, 1 }, { "__real__", T_REAL, 0, 0, 0, 0, 1, 0, 0 }, { "register", T_SCLASS, REG, 0, 0, 0, 0, 0, 0 }, { "__restrict__",T_QUAL, 0, 0, RESTRICT, 0, 1, 0, 0 }, { "restrict", T_QUAL, 0, 0, RESTRICT, 0, 1, 0, 0 }, { "return", T_RETURN, 0, 0, 0, 0, 0, 0, 0 }, { "__packed", T_PACKED, 0, 0, 0, 0, 0, 0, 0 }, + { "section", T_AT_SECTION, 0, 0, 0, 0, 0, 1, 1 }, + { "__section", T_AT_SECTION, 0, 0, 0, 0, 0, 1, 1 }, + { "__section__",T_AT_SECTION, 0, 0, 0, 0, 0, 1, 1 }, { "short", T_TYPE, 0, SHORT, 0, 0, 0, 0, 0 }, { "signed", T_TYPE, 0, SIGNED, 0, 1, 0, 0, 0 }, { "__signed__", T_TYPE, 0, SIGNED, 0, 0, 0, 0, 0 },