| 96 | } |
| 97 | |
| 98 | bool deprecated_ok_(bool deprecated_apis, |
| 99 | const char *feature, |
| 100 | const char *start, |
| 101 | const char *end, |
| 102 | const char **begs, |
| 103 | void (*complain)(const char *feature, bool allowing, void *cbarg), |
| 104 | void *cbarg) |
| 105 | { |
| 106 | enum deprecation_level level; |
| 107 | bool allow; |
| 108 | |
| 109 | /* Not deprecated at all? */ |
| 110 | if (!start) |
| 111 | return true; |
| 112 | |
| 113 | level = deprecation(start, end); |
| 114 | switch (level) { |
| 115 | case DEPRECATED_SOON: |
| 116 | return true; |
| 117 | case DEPRECATED: |
| 118 | /* Complain if we're disallowing becuase it's deprecated */ |
| 119 | allow = deprecated_apis; |
| 120 | if (!allow) |
| 121 | goto complain; |
| 122 | goto no_complain; |
| 123 | case DEPRECATED_COMPLAIN: |
| 124 | allow = deprecated_apis; |
| 125 | /* Always complain about these! */ |
| 126 | goto complain; |
| 127 | case DEPRECATED_BEG: |
| 128 | allow = false; |
| 129 | for (size_t i = 0; i < tal_count(begs); i++) { |
| 130 | if (streq(feature, begs[i])) |
| 131 | allow = true; |
| 132 | } |
| 133 | /* Don't complain about begging: they've explicitly noted this! */ |
| 134 | if (allow) |
| 135 | goto no_complain; |
| 136 | goto complain; |
| 137 | } |
| 138 | abort(); |
| 139 | |
| 140 | complain: |
| 141 | if (complain) |
| 142 | complain(feature, allow, cbarg); |
| 143 | no_complain: |
| 144 | return allow; |
| 145 | } |
nothing calls this directly
no test coverage detected