The formatting rules for GCC are described in and in

If you use Emacs, you can use M-x c-set-style and type 'gnu' for the style. And also, you can configure like this in your ~/.emacs file:

;; This line is not actually needed, it is on by default.
(setq-default indent-tabs-mode t)

(add-hook 'c-mode-hook 'linux-c-mode)
(defun linux-c-mode()
;; Return as C-j, newline and indent
 (define-key c-mode-map [return] 'newline-and-indent)
;; set gnu style.
 (c-set-style "gnu")
;; auto format when you type {
;; Backspace will delete the most space
;; TAB offset set to 2
 (setq c-basic-offset 2)
;; Show the function where the cursor is in.

Alternatively, on Emacs 23.1 or later, you can use directory-specific variables. Create a file .dir-locals.el in some directory between root and GCC sources with following contents:

((c-mode . ((c-file-style . "GNU")
            (c-basic-offset . 2)
            (indent-tabs-mode t))))

If you use Vim, you can use the following settings:

$ cat ~/.vim/after/ftplugin/c.vim
GNU Coding Standards
setlocal cindent
setlocal cinoptions=>4,n-2,{2,^-2,:2,=2,g0,h2,p5,t0,+2,(0,u0,w1,m1
setlocal shiftwidth=2
setlocal softtabstop=2
setlocal textwidth=79
setlocal fo-=ro fo+=cql