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

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -