Are there ways to format a C source code to contain only one statement per a line? -


i want know automatic way formatting c source code contain 1 statement each line. have tool this?

from this, want measure precise statement coverage using gcov.

for example,

from this

1: if(true) break; 

to this:

1: if(true) 2:     break; 

any useful comments appreciated. thank you.

note: please read want (only 1 statement per line!). have tried astyle , other beautifiers tools not provide function want. also, have searched google, no results have found.

gnu indent should achieve desired result. default style --gnu-style.

for input:

$ cat foo.c #include <stdio.h>  void f1 (int a){ printf("%d\n", a); }  int main() { if (true) break; f1('c'); printf("%i\n", 'c'); return 0; } 

indent default options transform into:

$ indent foo.c $ cat foo.c #include <stdio.h>  void f1 (int a) {   printf ("%d\n", a); }  int main () {   if (true)     break;   f1 ('c');   printf ("%i\n", 'c');   return 0; } 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -