diff options
| author | Justin Hibbits <jhibbits@FreeBSD.org> | 2020-01-18 02:39:38 +0000 |
|---|---|---|
| committer | Justin Hibbits <jhibbits@FreeBSD.org> | 2020-01-18 02:39:38 +0000 |
| commit | de8dd262c43bd9d687060fa7d50b6b6de73249c9 (patch) | |
| tree | a9c0e5631cf03f2235cc6ad98337973465f6c20c /sys/tools | |
| parent | 2d0c620272bcc0c78a53cbc1eed02b5792944856 (diff) | |
Notes
Diffstat (limited to 'sys/tools')
| -rw-r--r-- | sys/tools/makeobjops.awk | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/tools/makeobjops.awk b/sys/tools/makeobjops.awk index 5a4ccf759960d..c0fb8db10f3e6 100644 --- a/sys/tools/makeobjops.awk +++ b/sys/tools/makeobjops.awk @@ -325,13 +325,18 @@ function handle_method (static, doc) line_width, length(prototype))); } printh("{"); - printh("\tkobjop_t _m;"); + if (singleton) + printh("\tstatic kobjop_t _m;"); + else + printh("\tkobjop_t _m;"); if (ret != "void") printh("\t" ret " rc;"); if (!static) firstvar = "((kobj_t)" firstvar ")"; if (prolog != "") printh(prolog); + if (singleton) + printh("\tif (_m == NULL)"); printh("\tKOBJOPLOOKUP(" firstvar "->ops," mname ");"); rceq = (ret != "void") ? "rc = " : ""; printh("\t" rceq "((" mname "_t *) _m)(" varname_list ");"); @@ -453,6 +458,7 @@ for (file_i = 0; file_i < num_files; file_i++) { lastdoc = ""; prolog = ""; epilog = ""; + singleton = 0; while (!error && (getline < src) > 0) { lineno++; @@ -497,6 +503,8 @@ for (file_i = 0; file_i < num_files; file_i++) { prolog = handle_code(); else if (/^EPILOG[ ]*{$/) epilog = handle_code(); + else if (/^SINGLETON/) + singleton = 1; else { debug($0); warnsrc("Invalid line encountered"); |
