···15531553 """Ancillary routine to process a function prototype"""1554155415551555 # strip C99-style comments to end of line15561556- r = KernRe(r"\/\/.*$", re.S)15571557- line = r.sub('', line)15581558-15561556+ line = KernRe(r"\/\/.*$", re.S).sub('', line)15571557+ #15581558+ # Soak up the line's worth of prototype text, stopping at { or ; if present.15591559+ #15591560 if KernRe(r'\s*#\s*define').match(line):15601561 self.entry.prototype = line15611561- elif line.startswith('#'):15621562- # Strip other macros like #ifdef/#ifndef/#endif/...15631563- pass15641564- else:15621562+ elif not line.startswith('#'): # skip other preprocessor stuff15651563 r = KernRe(r'([^\{]*)')15661564 if r.match(line):15671565 self.entry.prototype += r.group(1) + " "15681568-15661566+ #15671567+ # If we now have the whole prototype, clean it up and declare victory.15681568+ #15691569 if '{' in line or ';' in line or KernRe(r'\s*#\s*define').match(line):15701570 # strip comments and surrounding spaces15711571- r = KernRe(r'/\*.*\*/')15721572- self.entry.prototype = r.sub('', self.entry.prototype).strip()15731573-15711571+ self.entry.prototype = KernRe(r'/\*.*\*/').sub('', self.entry.prototype).strip()15721572+ #15741573 # Handle self.entry.prototypes for function pointers like:15751574 # int (*pcs_config)(struct foo)15761576-15751575+ # by turning it into15761576+ # int pcs_config(struct foo)15771577+ #15771578 r = KernRe(r'^(\S+\s+)\(\s*\*(\S+)\)')15781579 self.entry.prototype = r.sub(r'\1\2', self.entry.prototype)15791579-15801580+ #15811581+ # Handle special declaration syntaxes15821582+ #15801583 if 'SYSCALL_DEFINE' in self.entry.prototype:15811584 self.entry.prototype = self.syscall_munge(ln,15821585 self.entry.prototype)15831583-15841584- r = KernRe(r'TRACE_EVENT|DEFINE_EVENT|DEFINE_SINGLE_EVENT')15851585- if r.search(self.entry.prototype):15861586- self.entry.prototype = self.tracepoint_munge(ln,15871587- self.entry.prototype)15881588-15861586+ else:15871587+ r = KernRe(r'TRACE_EVENT|DEFINE_EVENT|DEFINE_SINGLE_EVENT')15881588+ if r.search(self.entry.prototype):15891589+ self.entry.prototype = self.tracepoint_munge(ln,15901590+ self.entry.prototype)15911591+ #15921592+ # ... and we're done15931593+ #15891594 self.dump_function(ln, self.entry.prototype)15901595 self.reset_state(ln)15911596