Markus Mottl avatar Markus Mottl committed 26efdd7

Added stricter C-flags and improved C-code accordingly

Comments (0)

Files changed (4)

 
 BuildTools:       ocamldoc, ocamlbuild
 
+Flag strict
+  Description:    Strict compile-time checks
+  Default:        true
+
 Library postgresql
   Path:           lib
   FindlibName:    postgresql
   Modules:        Postgresql
   CSources:       postgresql_stubs.c
-  CCOpt:          -O2 -DPIC
+  CCOpt:          -g -O2 -fPIC -DPIC
+  if flag(strict) && ccomp_type(cc)
+    CCOpt+:       -Wall -pedantic -Wextra -Wunused -Wno-long-long
   CCLib:          -lpq
   BuildDepends:   threads, bigarray
 

lib/postgresql_stubs.c

   value v_params, value v_binary_params, size_t nparams,
   int **res_formats, int **res_lengths)
 {
-  int i, nbinary, *lengths, *formats;
-  nbinary = Wosize_val(v_binary_params);
+  size_t i, nbinary = Wosize_val(v_binary_params);
+  int *lengths, *formats;
   if (nbinary == 0 || nparams == 0) {
     *res_formats = NULL;
     *res_lengths = NULL;
 (* OASIS_START *)
-(* DO NOT EDIT (digest: 90f04300b15c714b6798df2ebf51a9f7) *)
+(* DO NOT EDIT (digest: 7a01d8524e97cf15aaa9928e9bb6ad68) *)
 module OASISGettext = struct
 (* # 21 "/Users/mmottl/local/darwin11.3.0/src/oasis-0.3.0/src/oasis/OASISGettext.ml" *)
 
           (["oasis_library_postgresql_ccopt"; "compile"],
             [
                (OASISExpr.EBool true,
-                 S [A "-ccopt"; A "-O2"; A "-ccopt"; A "-DPIC"])
+                 S
+                   [
+                      A "-ccopt";
+                      A "-g";
+                      A "-ccopt";
+                      A "-O2";
+                      A "-ccopt";
+                      A "-fPIC";
+                      A "-ccopt";
+                      A "-DPIC"
+                   ]);
+               (OASISExpr.EAnd
+                  (OASISExpr.EFlag "strict",
+                    OASISExpr.ETest ("ccomp_type", "cc")),
+                 S
+                   [
+                      A "-ccopt";
+                      A "-g";
+                      A "-ccopt";
+                      A "-O2";
+                      A "-ccopt";
+                      A "-fPIC";
+                      A "-ccopt";
+                      A "-DPIC";
+                      A "-ccopt";
+                      A "-Wall";
+                      A "-ccopt";
+                      A "-pedantic";
+                      A "-ccopt";
+                      A "-Wextra";
+                      A "-ccopt";
+                      A "-Wunused";
+                      A "-ccopt";
+                      A "-Wno-long-long"
+                   ])
             ]);
           (["oasis_library_postgresql_cclib"; "link"],
             [(OASISExpr.EBool true, S [A "-cclib"; A "-lpq"])]);
 
 let dispatch_default = MyOCamlbuildBase.dispatch_default package_default;;
 
-# 501 "myocamlbuild.ml"
+# 535 "myocamlbuild.ml"
 (* OASIS_STOP *)
 
 let () =
 (* setup.ml generated for the first time by OASIS v0.3.0 *)
 
 (* OASIS_START *)
-(* DO NOT EDIT (digest: f2276bbdb68e28e7a19a11941402bf7e) *)
+(* DO NOT EDIT (digest: 698133cd5beb2ac5bf7d610ab553ce08) *)
 (*
    Regenerated by OASIS v0.3.0
    Visit http://oasis.forge.ocamlcore.org for more information and
           files_ab = [];
           sections =
             [
+               Flag
+                 ({
+                     cs_name = "strict";
+                     cs_data = PropList.Data.create ();
+                     cs_plugin_data = [];
+                     },
+                   {
+                      flag_description = Some "Strict compile-time checks";
+                      flag_default = [(OASISExpr.EBool true, true)];
+                      });
                Library
                  ({
                      cs_name = "postgresql";
                         [ExternalTool "ocamldoc"; ExternalTool "ocamlbuild"];
                       bs_c_sources = ["postgresql_stubs.c"];
                       bs_data_files = [];
-                      bs_ccopt = [(OASISExpr.EBool true, ["-O2"; "-DPIC"])];
+                      bs_ccopt =
+                        [
+                           (OASISExpr.EBool true,
+                             ["-g"; "-O2"; "-fPIC"; "-DPIC"]);
+                           (OASISExpr.EAnd
+                              (OASISExpr.EFlag "strict",
+                                OASISExpr.ETest ("ccomp_type", "cc")),
+                             [
+                                "-g";
+                                "-O2";
+                                "-fPIC";
+                                "-DPIC";
+                                "-Wall";
+                                "-pedantic";
+                                "-Wextra";
+                                "-Wunused";
+                                "-Wno-long-long"
+                             ])
+                        ];
                       bs_cclib = [(OASISExpr.EBool true, ["-lpq"])];
                       bs_dlllib = [(OASISExpr.EBool true, [])];
                       bs_dllpath = [(OASISExpr.EBool true, [])];
           };
      oasis_fn = Some "_oasis";
      oasis_version = "0.3.0";
-     oasis_digest = Some "\152W0V��\156�\004SD����M";
+     oasis_digest = Some "�\006���Vi�\128\028b�YEY\129";
      oasis_exec = None;
      oasis_setup_args = [];
      setup_update = false;
 
 let setup () = BaseSetup.setup setup_t;;
 
-# 5912 "setup.ml"
+# 5940 "setup.ml"
 (* OASIS_STOP *)
 let () = setup ();;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.